mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-22 16:03:53 +00:00
37 lines
969 B
JavaScript
37 lines
969 B
JavaScript
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('!')
|
|
webpackConfig.module.loaders[3].loader = cssLoaders.map(item => {
|
|
if (item.startsWith('css')) {
|
|
return `css?${JSON.stringify(cssLoaderOption)}`
|
|
}
|
|
return item
|
|
}).join('!')
|
|
|
|
// PreLoaders
|
|
// webpackConfig.module.preLoaders = [{
|
|
// test: /\.js$/,
|
|
// enforce: 'pre',
|
|
// loader: 'eslint',
|
|
// }]
|
|
|
|
|
|
// Alias
|
|
webpackConfig.resolve.alias = {
|
|
components: `${__dirname}/src/components`,
|
|
utils: `${__dirname}/src/utils`,
|
|
config: `${__dirname}/src/utils/config`,
|
|
enums: `${__dirname}/src/utils/enums`,
|
|
}
|
|
|
|
return webpackConfig
|
|
}
|