-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
63 lines (59 loc) · 1.46 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
var path = require('path');
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker');
module.exports = {
context: __dirname,
devtool: 'inline-source-map',
entry:{
main: './static/js/index',
invite_form: './static/js/inviteForm',
user_change_form: './static/js/userChangeForm',
choice_form: './static/ts/components/choices/Index',
exam_form: './static/ts/components/examForm/Index',
main_css: './static/scss/index.scss'
},
output: {
path: path.resolve('./static/bundles/'),
filename: "[name].js"
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'})
],
optimization: {
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
lazy_libraries: {
test: /[\\/]node_modules[\\/]/,
chunks: 'async'
},
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all'
}
}
}
},
module: {
rules: [
{
test: /\.scss$/,
use: [
// fallback to style-loader in development
process.env.NODE_ENV !== 'production' ? 'style-loader' : MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
]
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ],
}
}