Skip to content

Commit

Permalink
Merge branch 'zemal_dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zema1 committed Dec 23, 2017
2 parents a960f62 + daf79c4 commit 6dceb51
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ test.vue

# build
vendor-manifest.json
vendor.dll.js
vendor.dll*.js

15 changes: 11 additions & 4 deletions build/webpack.base.conf.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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']
Expand All @@ -22,6 +23,8 @@ function getEntries() {
}
return base
}

// get all entries
const entries = getEntries()
console.log("All entries: ")
Object.keys(entries).forEach(entry => {
Expand All @@ -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,
Expand Down Expand Up @@ -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
}),
]
}
6 changes: 3 additions & 3 deletions build/webpack.dll.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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',
})
]
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/oj/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="renderer" content="webkit"/>
<link rel="shortcut icon" href="/public/website/favicon.ico">

<link href="static/css/loader.css" rel="stylesheet">
<link href="/static/css/loader.css" rel="stylesheet">
<script>
// IE 10 and earlier
if (window.navigator.userAgent.indexOf('MSIE ') > 0 &&
Expand Down

0 comments on commit 6dceb51

Please sign in to comment.