The hash here is changed from chunkhash to hash because chunkhash and content hash cannot be used after using hotmodulereplacementplugin
some places say that it is OK to remove “hot: true”, but my own actual test is not good. Just removing hot will still report an error; So I simply changed it to hash. Anyway, it’s local debugging, which has little impact
my approach is to distinguish environments and output different configurations in different environments.
in this way, the local test will not report errors
const dirVars = require('./base/dir-vars.config.js') const isOnlinepro = process.argv.indexOf('--env=onlinepro') !== -1 //If this parameter is present it is the production environment API_ROOT value is the cdn address const isTestpro = process.argv.indexOf('--env=testpro') !== -1 let rootPath = '' let outPath = '' if (isOnlinepro) { rootPath = '/tpl/' outPath = dirVars.buildOnline filename = 'static/js/[name].[chunkhash].js' } else if (isTestpro) { rootPath = '/build/' outPath = dirVars.buildDir filename = 'static/js/[name].[chunkhash].js' } else { rootPath = '/' outPath = dirVars.buildDir filename = 'static/js/[name].[hash].js' } module.exports = { ///entry path: outPath, publicPath: rootPath, filename: filename, // [name] is the key in each entry to specify the name of the generated file in bulk [name]. [chunkhash].js //chunkFilename: 'static/js/[id].bundle.js' //.[chunkhash] }
Similar Posts:
- How to Solve Const variable assignment Error
- Error: failed building wheel for pycrypto (pycrypto installation in Python 3.6 environment under win)
- Webpack high version pulls out CSS style and reports an error [Solved]
- How to Solve Phpize Run Error: Cannot find config.m4
- [Solved] Typeerror: can read property ‘index of’ of null
- [Solved] Protobuf Error: ‘tr1/unordered_map’ file not found
- A brief summary of hash calculation in resource packaging of unity
- Webpack 4 : ERROR in Entry module not found: Error: Can’t resolve ‘./src’
- error: command ‘gcc’ failed with exit status 1