-
Notifications
You must be signed in to change notification settings - Fork 2
/
.webpackrc
91 lines (81 loc) · 1.86 KB
/
.webpackrc
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const path = require('path');
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const development = process.env.NODE_ENV === 'development';
function d(dir) { return path.resolve(__dirname, dir); }
module.exports = {
entry: {
chip3: development? [
'webpack-dev-server/client?http://localhost:8080/',
'webpack/hot/only-dev-server',
'react-hot-loader/patch',
'babel-polyfill',
d('src/index.js'),
] : [
'babel-polyfill',
d('src/index.js'),
],
},
devtool: development
? "cheap-module-source-map"
: "hidden-source-map",
resolve: {
extensions: [ '.js', '.jsx', '.json' ],
modules: [ 'node_modules', d('./src') ],
},
module: {
loaders: [{
test: /\.jsx?$/,
include: d('src'),
loaders: ['babel-loader'],
}, {
test: /\.json$/,
loaders: ['json-loader'],
}, {
test: /\.(png|svg|html|css)$/,
include: d('src/Workbench'),
loaders: [
'file-loader?context=./src/Workbench&name=[name].[ext]?[hash:10]',
]
}]
},
node: {
fs: "empty"
},
devServer: {
noInfo: false,
hot: development,
historyApiFallback: true,
contentBase: d('dist'),
publicPath: 'http://localhost:8080/',
stats: { chunks: false },
},
output: {
path: d('dist'),
pathinfo: development,
filename: '[name].js',
library: 'Chip3',
libraryTarget: 'umd',
publicPath: development
? 'http://localhost:8080/'
: '/',
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.EnvironmentPlugin(['NODE_ENV']),
new webpack.LoaderOptionsPlugin({
debug: development,
minimize: !false,
}),
].concat(development? [
new webpack.HotModuleReplacementPlugin(),
new WebpackShellPlugin({
'onBuildStart': "open 'http://localhost:8080'",
}),
] : [
new webpack.optimize.UglifyJsPlugin({
comments: /\/\/#/, // Keep only source maps
compress: { warnings: false },
}),
]),
};