-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (42 loc) · 1.26 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
const path = require('path');
const webpack = require('webpack');
const HtmlPlugin = require('html-webpack-plugin');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const CWD = process.cwd();
const DLL_DIST = path.join(CWD, 'dll');
const SCOPE_DLL_DIST = path.join(CWD, 'scope-dll');
module.exports = {
mode: process.env.NODE_ENV,
context: CWD,
entry: './index',
devtool: false,
output: {
path: path.join(CWD, 'dist'),
filename: '[name].[hash].js'
},
plugins: [
// reference dll
new webpack.DllReferencePlugin({
manifest: path.join(DLL_DIST, 'manifest.json')
}),
new webpack.DllReferencePlugin({
scope: 'scoped',
manifest: path.join(SCOPE_DLL_DIST, 'manifest.json')
}),
// generate index.html
new HtmlPlugin({
template: path.join(CWD, './index.html')
}),
// insert vendors.js into html
new AddAssetHtmlPlugin([
{
filepath: path.join(DLL_DIST, 'dll.js'),
includeSourcemap: false
},
{
filepath: path.join(SCOPE_DLL_DIST, 'scope-dll.js'),
includeSourcemap: false
}
])
]
}