-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
61 lines (60 loc) · 1.48 KB
/
webpack.config.js
File metadata and controls
61 lines (60 loc) · 1.48 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
52
53
54
55
56
57
58
59
60
61
const webpack = require('webpack');
const path = require('path');
// including sass
module.exports = [{
entry: [
'eventsource-polyfill',
'./src/index'],
output: {
path: path.join(__dirname, '/public'),
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.js?$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.sass$/, use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sassOptions: {
fiber: false
},
},
},
], exclude: /node_modules/ },
]
},
resolve: {
extensions: ['.js','.sass', ".jsx"]
}
,
devServer: {
port: process.env.PORT || 8000,
host: "localhost",
contentBase: "./public",
historyApiFallback: true,
hot: true,
inline: true
}
,plugins: [
new webpack.NamedModulesPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({ // <-- key to reducing React's size
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.ProvidePlugin({
React: 'react',
ReactDOM:'react-dom'
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(), //dedupe similar code
new webpack.optimize.UglifyJsPlugin(), //minify everything
new webpack.optimize.AggressiveMergingPlugin()//Merge chunks
]
}];