-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
58 lines (57 loc) · 1.45 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
let FaviconsWebpackPlugin = require('favicons-webpack-plugin')
let extractHtml = new ExtractTextPlugin('[name].html')
let extractStyles = new ExtractTextPlugin('[name].css')
// var Uglify = webpack.optimize.UglifyJsPlugin
const path = require('path')
const PATHS = {
app: path.join(__dirname, 'app'),
build: path.join(__dirname, 'build')
}
module.exports = {
entry: PATHS.app,
output: {
path: PATHS.build,
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['stage-0', 'env'],
plugins: ['transform-runtime']
}
},
{
test: /\.pug$/,
loaders: ['file-loader?name=./[name].html', 'pug-html-loader?pretty&exports=false']
},
{
test: /\.css$/,
exclude: /node_modules/,
use: extractStyles.extract({
fallback: 'style-loader',
use: 'css-loader'
})
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jQuery-slim',
jQuery: 'jquery-slim',
'window.jQuery': 'jquery'
}),
new HtmlWebpackPlugin({
template: 'app/index.pug'
}),
extractStyles,
extractHtml,
new FaviconsWebpackPlugin('./app/assets/favicon.png')
]
}