forked from mozilla/id.webmaker.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (46 loc) · 1.27 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
var webpack = require('webpack');
var IMPORT_ES5_SHIM = 'imports?shim=es5-shim/es5-shim&' +
'sham=es5-shim/es5-sham';
function importEnvVars(keys) {
var result = {};
keys.forEach(function(key) {
if (typeof (process.env[key]) === 'string') {
result['process.env.' + key] = JSON.stringify(process.env[key]);
}
});
return result;
}
module.exports = {
entry: {
app: './templates/index.jsx',
tests: './test/browser.tests.jsx',
manual: './test/manual.tests.jsx'
},
devtool: process.env.WEBPACK_DEVTOOL || 'source-map',
output: {
path: __dirname + '/public',
filename: '[name].bundle.js'
},
module: {
loaders: [
{ test: /\.jsx$/, loaders: ['babel', 'jsx-loader'] },
// https://github.com/webpack/webpack/issues/558#issuecomment-60889168
{ test: require.resolve('react'), loader: IMPORT_ES5_SHIM },
{ test: require.resolve('react/addons'), loader: IMPORT_ES5_SHIM },
{ test: /\.json$/, loader: 'json-loader' }
]
},
node: {
net: 'empty',
dns: 'empty'
},
plugins: [
new webpack.DefinePlugin(importEnvVars([
// Any variables we want to expose to the client:
'GA_TRACKING_ID',
'GA_DEBUG',
'OPTIMIZELY_ID',
'OPTIMIZELY_ACTIVE'
]))
]
};