-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
40 lines (36 loc) · 994 Bytes
/
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
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/app/index.html',
filename: 'index.html',
inject: 'body'
});
var ExtractTextPluginConfig = new ExtractTextPlugin('style.css');
var entrypoint = process.env.npm_lifecycle_event === 'dev' ?
'webpack-dev-server/client?http://localhost:8080' :
'./app/index.js';
module.exports = {
entry: entrypoint,
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
include: __dirname + '/app',
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0']
}
},
{
test: /\.scss$/,
include: __dirname + '/app',
loader: ExtractTextPlugin.extract('css!sass')
}
]
},
plugins: [HtmlWebpackPluginConfig, ExtractTextPluginConfig]
}