-
Notifications
You must be signed in to change notification settings - Fork 607
/
Copy pathwebpack-base.config.js
39 lines (35 loc) · 1.26 KB
/
webpack-base.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
'use strict';
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const createWebpackConfigCommon = require('../../shared/webpack-base.config');
module.exports = function createWebpackConfig({ env, argv, projectRoot, configOverride }) {
// Documentation: https://webpack.js.org/configuration/
const applicationOverrides = {
target: ['web', 'es5'],
entry: {
app: path.resolve(projectRoot, 'lib', 'start.js')
},
optimization: {
splitChunks: {
chunks: 'all'
}
},
plugins: [
// NOTE: If your project's webpack.config.js provides its own "HtmlWebpackPlugin" configuration,
// it will replace the default definition here. This replacement is implemented
// using mergeWithCustomize() in shared/webpack-base.config.js
// See here for documentation: https://github.com/jantimon/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(projectRoot, 'assets', 'index.html')
})
]
};
return createWebpackConfigCommon({
env: env,
argv: argv,
projectRoot: projectRoot,
extractCssInProduction: true,
configOverride: createWebpackConfigCommon.merge(applicationOverrides, configOverride)
});
};