module.exports = (webpackConfig, env) => { // FilenameHash // https://webpack.js.org/configuration/output/#output-chunkfilename webpackConfig.output.chunkFilename = '[name].[hash].js' 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 = [{ // 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 }