forked from vusion-templates/admin-cloud-fs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dll.config.js
39 lines (38 loc) · 1.21 KB
/
webpack.dll.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
const path = require('path');
const webpack = require('webpack');
module.exports = (env = {}) => {
const name = env.NODE_ENV === 'production' ? '[name]' : '[name].dev';
return {
entry: {
vendor: ['babel-polyfill', 'whatwg-fetch', 'vue', 'vue-router'],
},
output: {
filename: `${name}.js`,
path: path.resolve(__dirname, './dll'),
publicPath: '/public/',
library: '[name]',
},
resolve: {
alias: {
vue$: path.resolve(__dirname, 'node_modules/vue/dist/vue.esm.js'),
'vue-router$': path.resolve(__dirname, 'node_modules/vue-router/dist/vue-router.esm.js'),
},
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: `"${env.NODE_ENV}"`,
},
}),
new webpack.DllPlugin({
path: path.join(__dirname, './dll', `${name}.manifest.json`),
name: '[name]',
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
}),
],
};
};