-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
44 lines (42 loc) · 1.19 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
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
module.exports = {
devtool: 'source-map',
target: 'web',
entry: ['babel-polyfill', './app/js/main'],
output: {
filename: 'app.js?[hash]',
path: path.join(__dirname, 'public'),
publicPath: '/'
},
module: {
loaders: [{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['es2015', 'stage-0', 'react']
}
},{
test: /\.json$/,
loader: 'json'
},{
test: /\.css$/,
loader: ExtractTextPlugin.extract('css-loader')
}]
},
resolve: {
extensions: ['', '.js']
},
plugins: [
new webpack.EnvironmentPlugin(['NODE_ENV', 'API_ROOT']),
new ExtractTextPlugin('[name].css?[contenthash]', { allChunks: true }),
new webpack.optimize.UglifyJsPlugin({ compressor: { warnings: false } }),
new webpack.optimize.DedupePlugin(),
new HtmlWebpackPlugin({ template: 'app/index-template.html' })
],
modulesDirectories: ['node_modules']
}