-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
64 lines (61 loc) · 1.42 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
59
60
61
62
63
64
var path = require("path");
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker');
const COMPONENT_DIR = path.resolve(__dirname, 'static', 'components')
const STATIC_DIR = path.resolve(__dirname, 'static');
const COURSE_SOURCE_DIR = path.resolve(STATIC_DIR, 'course', 'js', 'src');
const ASSIGNMENT_SOURCE_DIR = path.resolve(STATIC_DIR, 'assignment', 'js', 'src');
module.exports = {
mode: "production",
devtool: 'source-map',
entry: {
course: path.resolve(COURSE_SOURCE_DIR, 'index.js'),
assignment: path.resolve(ASSIGNMENT_SOURCE_DIR, 'index.js'),
},
output: {
filename: `[name]-1.0.0.js`,
path: path.resolve(STATIC_DIR, 'bundles'),
publicPath: ''
},
optimization: {
splitChunks: {
cacheGroups: {
default: false,
vendors: false,
vendor: {
name: 'vendors',
chunks: 'all',
test: /node_modules/
}
}
},
minimize: true
},
plugins: [
new BundleTracker({
path: path.resolve(STATIC_DIR, 'bundles'),
filename: "./webpack-stats.json"
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
},
resolve: {
alias: {
components: COMPONENT_DIR,
},
extensions: ['*', '.js', '.jsx']
},
externals: {
react: 'React',
'react-dom': 'ReactDOM'
}
};