-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
45 lines (41 loc) · 1.3 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
const webpack = require('webpack');
const path = require('path');
const BundleTracker = require('webpack-bundle-tracker');
const devMode = process.env.NODE_ENV !== 'production';
const devModeServer = 'http://localhost:8080';
const config = {
entry: {
'score_sheet': './js_src/scoreSheet.js',
'target_input': './js_src/targetInput.js',
'target_list': './js_src/targetList.js'
},
mode: devMode ? 'development' : 'production',
output: {
filename: devMode ? '[name].js' : '[name]-[contenthash].js',
path: path.resolve(__dirname, 'build/bundles'),
publicPath: devMode ? `${devModeServer}/bundles/` : undefined,
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
}
]
},
plugins: [
new BundleTracker({
path: path.resolve(__dirname, 'build'),
filename: 'webpack-stats.json'
}),
],
devServer: {
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization",
},
},
};
module.exports = config;