1. An error occurs when the happypack plug-in splits the build task into multiple sub-processes for concurrent execution
During webpack optimization, use cache-loader for cache optimization and then use it again
The happypack plugin will split the build task into multiple sub-processes for concurrent execution.
AssertionError [ERR_ASSERTION]: HappyPack: Unrecognized option ‘loader’
The configuration code is shown below:
Plugins are configured as follows:
But now the error is as follows:
AssertionError [ERR_ASSERTION]: HappyPack: Unrecognized option ‘loader’
Loader is not recognized.
After trying to compare more than N methods, or will always report the error, foundIn the rules andPlugins all use the term useWay, will no longer report the error
But continue to report the following error (beware of tired…)
Cannot read property ‘outputOptions’ of undefined
Then do a github search for the reason that the MiniCssExtractPlugin appears when used with HappyPack
Then leave it aloneMiniCssExtractPluginThis loader refers to the rules, not multithreaded loading
Error: No PostCSS Config found in **
The solution is: when postcss-loader is configured in Happypack, postcss.config.js must be created in the project
//postcss.config.js
module.exports = {
plugins: [
require('autoprefixer')()
]
}
Copy the code
The following error is reported after the project is created and restarted:
TypeError: Cannot read property ‘split’ of undefined
It’s back to the mini-CSs-extract-plugin loader
I searched for related questions on Github and saw similar feedback
But it’s not the same problem I’m having, and if I putMiniCssExtractPlugin.loader
On the‘HappyPack/loader? id=css’And then, it’s going to becss-loaderAfter these loaders, the problems of the above topic will also occur
2. Uglip-js-plugin package does not support ES6 syntax
Because the version of Ugliy-js-plugin is relatively old, in the process of packaging compressed JS code, because it does not support the recognition of ES6 syntax, packaging error will be reported. It is suggested to replace it with other plug-ins with similar functions, such as terser-webpack-plugin
3. WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Error cause, asset and entry point exceed specified file limit, do the following configuration in webpack configuration file: