add build:dll

This commit is contained in:
zuiidea
2017-07-27 20:02:20 +08:00
parent 1e08d7adaa
commit 00d8fc5ea5
4 changed files with 29 additions and 17 deletions
+11 -1
View File
@@ -36,5 +36,15 @@ export default {
["import", { "libraryName": "antd", "style": true}]
]
}
}
},
"dllPlugin": {
"exclude": [
"babel-runtime"
],
"include": [
"dva/router",
"dva/saga",
"dva/fetch",
]
}
}
+2 -1
View File
@@ -50,6 +50,7 @@
"scripts": {
"dev": "set BROWSER=none&&set HOST=0.0.0.0&&roadhog server",
"lint": "eslint --fix --ext .js src",
"build": "roadhog build"
"build": "roadhog build",
"build:dll": "roadhog buildDll"
}
}
+1
View File
@@ -26,6 +26,7 @@
}
})()
</script>
<script src="roadhog.dll.js"></script>
<script src="/index.js"></script>
</body>
+15 -15
View File
@@ -1,21 +1,22 @@
module.exports = (webpackConfig) => {
module.exports = (webpackConfig, env) => {
// FilenameHash
// https://webpack.js.org/configuration/output/#output-chunkfilename
webpackConfig.output.chunkFilename = '[name].[hash].js'
// ClassnameHash
// webpackConfig.module.rules.map((item) => {
// if (item.use && item.use[0] === 'style') {
// return item.use.map((iitem) => {
// if (iitem && iitem.loader === 'css') {
// iitem.options.localIdentName = '[hash:base64:5]'
// }
// return iitem
// })
// }
// return item
// })
if (env === 'production' && webpackConfig.module) {
// ClassnameHash
webpackConfig.module.rules.map((item) => {
if (item.use && item.use[0] === 'style') {
return item.use.map((iitem) => {
if (iitem && iitem.loader === 'css') {
iitem.options.localIdentName = '[hash:base64:5]'
}
return iitem
})
}
return item
})
}
// PreLoaders
// webpackConfig.module.preLoaders = [{
@@ -24,7 +25,6 @@ module.exports = (webpackConfig) => {
// loader: 'eslint',
// }]
// Alias
webpackConfig.resolve.alias = {
components: `${__dirname}/src/components`,