Webpack common debugging problems

Common problems of webpack packaging

Problem 1:
peerDependencies WARNING webpack-dev-server@* requires a peer of webpack@^4.0.0 || ^5.0.0 but [email protected] was installed
peerDependencies WARNING [email protected] › webpack- dev-middleware@^3.7.2 requires a peer of webpack@^4.0.0 but [email protected] was installed insert image description here
Prompt to install this tool, or package, the corresponding version of other packages required, already installed in this example webpack3.8.1 needs to be upgraded to version 4.0.0 or 5.0.0.
question two

insert image description here
Prompt us to install webpack-li
Question 3
ERROR in multi ./src/main.js ./dist/bundle.js
Module not found: Error: Can't resolve './dist/bundle.js' in 'D:\VS Code\work\WEBPACK-STUDY'
insert image description here
, because the version is different, the packaging instructions are also different, some versions directly
webpack to package the file to generate the package file, for example: webpack ./src/main.js ./dist/bundle.js
Some versions of webpack need to pack files -o to generate packaged files, for example: webpack ./src/main.js -o ./dist/bundle.js

question four
insert image description here

ERROR in ./node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js
Module not found: Error: Can’t resolve ‘child_process’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jsdom\lib\jsdom\living\xhr’
@ ./node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js 4:22-46
@ ./node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js
@ ./node_modules/jsdom/lib/jsdom/living/interfaces.js
@ ./node_modules/jsdom/lib/jsdom/browser/Window.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/jsdom/lib/api.js
Module not found: Error: Can’t resolve ‘fs’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jsdom\lib’
@ ./node_modules/jsdom/lib/api.js 3:11-24
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
Module not found: Error: Can’t resolve ‘fs’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jsdom\lib\jsdom\browser\resources’
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js 2:11-24
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js
Module not found: Error: Can’t resolve ‘fs’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jsdom\lib\jsdom\living\xhr’
@ ./node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js 2:11-24
@ ./node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js
@ ./node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js
@ ./node_modules/jsdom/lib/jsdom/living/interfaces.js
@ ./node_modules/jsdom/lib/jsdom/browser/Window.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can’t resolve ‘fs’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\request\lib’
@ ./node_modules/request/lib/har.js 3:9-22
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/living/helpers/wrap-cookie-jar-for-request.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/jquery/node-jquery.js
Module not found: Error: Can’t resolve ‘location’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jquery’ @ ./node_modules/jquery/node-jquery.js 6:32-51
@ ./src/main.js

ERROR in ./node_modules/jquery/node-jquery.js
Module not found: Error: Can’t resolve ‘navigator’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jquery’
@ ./node_modules/jquery/node-jquery.js 7:34-54
@ ./src/main.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can’t resolve ‘net’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\forever-agent’
@ ./node_modules/forever-agent/index.js 6:10-24
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/living/helpers/wrap-cookie-jar-for-request.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/request-promise-native/node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can’t resolve ‘net’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\request-promise-native\node_modules\tough-cookie\lib’
@ ./node_modules/request-promise-native/node_modules/tough-cookie/lib/cookie.js 32:10-24
@ ./node_modules/request-promise-native/lib/rp.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/request/node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can’t resolve ‘net’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\request\node_modules\tough-cookie\lib’
@ ./node_modules/request/node_modules/tough-cookie/lib/cookie.js 32:10-24
@ ./node_modules/request/lib/cookies.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/living/helpers/wrap-cookie-jar-for-request.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can’t resolve ‘net’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\tunnel-agent’
@ ./node_modules/tunnel-agent/index.js 3:10-24
@ ./node_modules/request/lib/tunnel.js
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/living/helpers/wrap-cookie-jar-for-request.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can’t resolve ‘tls’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\forever-agent’
@ ./node_modules/forever-agent/index.js 7:10-24
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/living/helpers/wrap-cookie-jar-for-request.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/tunnel-agent/index.js

@ ./node_modules/tunnel-agent/index.js 4:10-24
@ ./node_modules/request/lib/tunnel.js
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/living/helpers/wrap-cookie-jar-for-request.js
@ ./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/jquery/node-jquery.js
@ ./src/main.js

ERROR in ./node_modules/jquery/node-jquery.js
Module not found: Error: Can’t resolve ‘xmlhttprequest’ in ‘D:\VS Code\work\WEBPACK-STUDY\node_modules\jquery’
@ ./node_modules/jquery/node-jquery.js 10:28-53
@ ./src/main.js

My problem is the installed version of jquery. I changed the lower version of jquery to solve
npm install [email protected] -D

Vegetable dog's growth path. come on! ! !

Guess you like

Origin blog.csdn.net/qq_41117240/article/details/104963966