Config DllPlugin

This commit is contained in:
lin-xin 2017-04-01 16:20:58 +08:00
parent 659472eac3
commit 6c5869ff0e
6 changed files with 1378 additions and 2 deletions

1309
build/vendor-manifest.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
var path = require('path')
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')
@ -59,5 +60,11 @@ module.exports = {
}
}
]
}
},
plugins: [
new webpack.DllReferencePlugin({
context: path.resolve(__dirname, '..'),
manifest: require('./vendor-manifest.json')
})
]
}

29
build/webpack.dll.conf.js Normal file
View File

@ -0,0 +1,29 @@
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
vendor: ['vue/dist/vue.common.js','vue-router', 'babel-polyfill','axios','vue-echarts-v3']
},
output: {
path: path.join(__dirname, '../static/js'),
filename: '[name].dll.js',
library: '[name]_library'
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, '.', '[name]-manifest.json'),
name: '[name]_library'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
})
]
};

View File

@ -9,6 +9,7 @@
</head>
<body>
<div id="app"></div>
<script src="./static/js/vendor.dll.js"></script>
<script>
var _hmt = _hmt || [];
(function() {

View File

@ -6,7 +6,8 @@
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"build": "node build/build.js"
"build": "node build/build.js",
"build:dll": "webpack --config build/webpack.dll.conf.js"
},
"dependencies": {
"axios": "^0.15.3",

29
static/js/vendor.dll.js Normal file

File diff suppressed because one or more lines are too long