-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
50 lines (49 loc) · 1.07 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
var webpack = require('webpack'),
ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: './src/index.js',
output: {
path: './build',
filename: 'bundle.js'
},
resolve: {
modulesDirectories: [
'./src/lib',
'node_modules'
]
},
module: {
preLoaders: [
{ loader: 'source-map' }
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.(less|css)$/,
loader: ExtractTextPlugin.extract("style?sourceMap", "css?sourceMap!autoprefixer?browsers=last 2 version!less")
}
]
},
plugins: ([
new webpack.NoErrorsPlugin(),
new webpack.optimize.DedupePlugin(),
new ExtractTextPlugin('style.css', { allChunks: true })
]).concat(process.env.WEBPACK_ENV==='dev' ? [] : [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
output: { comments: false },
exclude: [/\.min\.js$/gi]
})
]),
stats: { colors: true },
devtool: 'source-map',
devServer: {
port: process.env.PORT || 8080,
contentBase: './src',
historyApiFallback: true
}
};