Files
antd-admin/webpack.config.js
T
2017-07-05 19:45:57 +08:00

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
}