Webpack Building Tools FAQs and Solutions
在运用webpack开发项目的时候经常会遇到各种各样的问题,我对实际开发项目中实际遇到的一些问题 进行总结,希望能帮助到大家。
??
1. Build the required packages without adding dependency errors
Module not found:"xxx(例:react)" in "项目文件"
??
This situation is due to "xxx (example: react)" Not added dependency, the workaround is as follows:
npm install xxx(react) --save 或
??
2. Build process Dependent package version is not compatible with the error
??
Failed to minify the bundle. Error:xxx from Uglifyjs
??
This is typically the case in the project build process, with the following workaround:
Delete the Node_modules folder in the project and rebuild it with NPM or yarn reload:
npm install 或 yarn install
Depending on the version incompatibility between packages, it is necessary to recall the newly added dependency packages and to take the corresponding packages to the ascending version (in yarn case):
yarn add [email protected][]
Then make a version switch (take query-string as an example):
Finally rebuild the project.
3. Errors caused by mis-writing, omission or writing
SynatxError:Unexpected identifier
?? This kind of error, generally because the JS code in the writing of the error (example: missing symbols, malformed or hand-shaking delete some code is possible), carefully check the code can be avoided.
Webpack Building Tools FAQs and Solutions