Filename and Classname To Hash

This commit is contained in:
zuiidea
2017-06-07 19:46:56 +08:00
parent 0295da6326
commit 05a86e2f56
+16
View File
@@ -0,0 +1,16 @@
module.exports = (webpackConfig) => {
// FilenameHash
webpackConfig.output.chunkFilename = '[name].[hash].js' // http://webpack.github.io/docs/configuration.html#output-chunkfilename
// ClassnameHash
const cssLoaderOption = {
importLoaders: 1,
modules: true,
localIdentName: '[hash:base64:5]',
}
const cssLoaders = webpackConfig.module.loaders[3].loader.split('!')
cssLoaders[1] = `css?${JSON.stringify(cssLoaderOption)}`
webpackConfig.module.loaders[3].loader = cssLoaders.join('!')
return webpackConfig
}