forked from babel/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (46 loc) · 1.03 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
'use strict';
const webpack = require('webpack');
const DEV_SERVER_PORT = 34512;
const config = {
entry: {
repl: './js/repl/index.js',
},
output: {
// Don't bother with hashing/versioning the filename - Netlify does it
// for us in prod.
filename: '[name].js',
path: __dirname + '/website/static/js/build/',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
plugins: [
],
externals: {
codemirror: 'CodeMirror',
'lz-string': 'LZString',
react: 'React',
'react-dom': 'ReactDOM',
},
};
if (process.env.NODE_ENV !== 'production') {
// Enable hot reloading in dev
config.output.publicPath = `http://localhost:${DEV_SERVER_PORT}/`;
config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.devServer = {
compress: true,
contentBase: false,
hot: true,
port: DEV_SERVER_PORT,
headers: {
'Access-Control-Allow-Origin': '*'
}
};
}
module.exports = config;