diff --git a/.gitignore b/.gitignore
index 52061c5ec..3ac4b4b4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,5 +66,5 @@ test.vue
# build
vendor-manifest.json
-vendor.dll.js
+vendor.dll*.js
diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index fa1288b58..e239a8581 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -1,5 +1,6 @@
'use strict'
const path = require('path')
+const glob = require('glob')
const webpack = require('webpack')
const utils = require('./utils')
const config = require('../config')
@@ -10,7 +11,7 @@ function resolve (dir) {
return path.join(__dirname, '..', dir)
}
-function getEntries() {
+function getEntries () {
const base = {
'oj': ['./src/pages/oj/index.js'],
'admin': ['./src/pages/admin/index.js']
@@ -22,6 +23,8 @@ function getEntries() {
}
return base
}
+
+// get all entries
const entries = getEntries()
console.log("All entries: ")
Object.keys(entries).forEach(entry => {
@@ -32,6 +35,11 @@ Object.keys(entries).forEach(entry => {
console.log()
})
+// prepare vendor asserts
+const globOptions = {cwd: resolve('static/js')};
+let vendorAssets = glob.sync('vendor.dll.*.js', globOptions);
+vendorAssets = vendorAssets.map(file => 'static/js/' + file)
+
module.exports = {
entry: entries,
@@ -107,10 +115,9 @@ module.exports = {
manifest: require('./vendor-manifest.json')
}),
new HtmlWebpackIncludeAssetsPlugin({
- assets: ['static/js/vendor.dll.js'],
+ assets: [vendorAssets[0]],
files: ['index.html', 'admin/index.html'],
- append: false,
- hash: true
+ append: false
}),
]
}
diff --git a/build/webpack.dll.conf.js b/build/webpack.dll.conf.js
index e73c61ede..4e035192d 100644
--- a/build/webpack.dll.conf.js
+++ b/build/webpack.dll.conf.js
@@ -23,8 +23,8 @@ module.exports = {
},
output: {
path: path.join(__dirname, '../static/js'),
- filename: '[name].dll.js',
- library: '[name]_dll',
+ filename: '[name].dll.[hash:7].js',
+ library: '[name]_[hash]_dll',
},
plugins: [
new webpack.DefinePlugin({
@@ -40,7 +40,7 @@ module.exports = {
new webpack.DllPlugin({
context: __dirname,
path: path.join(__dirname, '[name]-manifest.json'),
- name: '[name]_dll',
+ name: '[name]_[hash]_dll',
})
]
};
diff --git a/package.json b/package.json
index 6a8fce543..e7990caeb 100644
--- a/package.json
+++ b/package.json
@@ -63,6 +63,7 @@
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
+ "glob": "^7.1.2",
"html-webpack-include-assets-plugin": "^1.0.2",
"html-webpack-plugin": "^2.30.1",
"http-proxy-middleware": "^0.17.3",
diff --git a/src/pages/oj/index.html b/src/pages/oj/index.html
index a682688d2..ed482f937 100644
--- a/src/pages/oj/index.html
+++ b/src/pages/oj/index.html
@@ -8,7 +8,7 @@
-
+