-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathwebpack.config.js
55 lines (51 loc) · 1.37 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
const webpack = require('webpack');
const path = require('path');
const production = process.env.HEROKU || process.env.TRAVIS;
const config = {
entry: {
login: './src/js/login/app.js',
room: './src/js/app.js',
screen: './src/js/screen/app.js',
whiteboard: './src/js/whiteboard/app.js',
},
output: {
path: './public/js/',
filename: '[name].bundle.min.js',
chunkFilename: '[id].chunk.min.js',
},
devtool: 'source-map',
module: {
loaders: [
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.html$/, loader: 'raw' },
// { test: /codemirror\/mode(?!.*(javascript|markdown)).*/, loader: 'null' }
],
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
filename: 'commons.min.js',
name: 'commons',
}),
],
};
if (production) {
// Add in dedupe, uglify and babel for production
config.plugins = config.plugins.concat([
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
]);
config.module.loaders = config.module.loaders.concat([
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules(?!\/(opentok-textchat|opentok-camera-filters|filterous))/,
query: {
presets: ['babel-preset-env'].map(require.resolve),
},
},
]);
}
module.exports = config;