提交 6c5869ff 编写于 作者: L lin-xin

Config DllPlugin

上级 659472ea
此差异已折叠。
var path = require('path') var path = require('path')
var utils = require('./utils') var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config') var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf') var vueLoaderConfig = require('./vue-loader.conf')
...@@ -59,5 +60,11 @@ module.exports = { ...@@ -59,5 +60,11 @@ module.exports = {
} }
} }
] ]
} },
plugins: [
new webpack.DllReferencePlugin({
context: path.resolve(__dirname, '..'),
manifest: require('./vendor-manifest.json')
})
]
} }
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"'
}
})
]
};
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script src="./static/js/vendor.dll.js"></script>
<script> <script>
var _hmt = _hmt || []; var _hmt = _hmt || [];
(function() { (function() {
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "node build/dev-server.js", "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": { "dependencies": {
"axios": "^0.15.3", "axios": "^0.15.3",
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册