forked from omegaup/omegaup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
42 lines (36 loc) · 1.06 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const frontendConfig = require('./webpack.config-frontend.js');
// Generate the JSON dependency objects.
for (const entryname of Object.keys(frontendConfig.entry)) {
frontendConfig.plugins.push(
new HtmlWebpackPlugin({
inject: false,
chunks: [entryname],
filename: `js/dist/${entryname}.deps.json`,
template: path.resolve(__dirname, './stuff/webpack/deps.ejs'),
}),
);
}
const config = [
frontendConfig,
require('./webpack.config-style.js'),
require('./webpack.config-grader.js'),
];
module.exports = (env, argv) => {
const devtool =
(argv && argv.mode !== 'development') ? 'source-map' : 'cheap-source-map';
for (const entry of config) {
Object.assign(entry, {
devtool: devtool,
devServer: {historyApiFallback: true, noInfo: true},
performance: {hints: false},
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
ignored: /node_modules/,
},
});
}
return config;
};