-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
51 lines (50 loc) · 1.5 KB
/
webpack.config.js
File metadata and controls
51 lines (50 loc) · 1.5 KB
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
const path = require('path')
const root = path.resolve(__dirname, './')
const webpack = require('webpack')
const HtmlwebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
entry: [
'react-hot-loader/patch',
'webpack-dev-server/client',
'webpack/hot/only-dev-server',
path.join(root, 'src/index.js')
],
output: {
filename: '[name].js',
path: path.join(root, 'dist')
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
images: path.join(root, 'src/assets/images'),
styles: path.join(root, 'src/assets/styles')
}
},
module: {
loaders: [
{ test: /\.jsx?$/, loaders: ['babel-loader'], exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.styl$/, loader: 'style-loader!css-loader!stylus-loader' },
{ test: /\.(png|jpg|eot|woff|ttf|svg)$/, loader: 'url-loader?limit=8192' }
]
},
devtool: '#source-map',
devServer: {
historyApiFallback: true
// hot: true,
// contentBase: path.resolve(root, 'dist'),
// publicPath: '/'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
// new ExtractTextPlugin({ filename: '[name].css', disable: false, allChunks: true }),
new webpack.optimize.CommonsChunkPlugin('common'),
new webpack.HotModuleReplacementPlugin(),
new HtmlwebpackPlugin({ template: path.join(root, './src/index.html') })
]
}