forked from openexp/openexp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
58 lines (48 loc) · 1.62 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
51
52
53
54
55
56
57
58
const webpack = require('webpack');
const path = require('path');
// Now you can use if (__DEV__) around the app to exclude code from production
var definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'true'))
});
var config = {
entry: {
vendor: './client/vendor.js',
app: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080',
'./client/index.js'
]
},
"target": 'atom',
output: {
path: __dirname + '/client/build',
publicPath: '/build/',
filename: '[name].js',
pathinfo: true
},
resolve: {
root: [path.join(__dirname, "/node_modules")]
},
devServer: {
hot: true
},
module: {
loaders: [
{test: /src.*\.js$/, loaders: ['ng-annotate', 'babel-loader'], exclude: /node_modules/},
{test: /\.(eot|woff|svg|woff2|dtd|ttf)$/, loaders: ["file"], exclude: /node_modules/ },
{test: /\.scss$/, loaders: ["style", "css", "sass?"], exclude: /node_modules/},
{test: /\.(jpe?g|png|gif|svg)$/i, loaders: [], exclude: /node_modules/},
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
definePlugin
]
};
if (process.env.NODE_ENV === 'production') {
// comment the bottom line to avoid minification
//config.plugins.push(new webpack.optimize.UglifyJsPlugin());
config.entry.app = ['./client/index.js'];
}
module.exports = config;