In the vue project, it is clear that the prompt information output on the console has been turned off through the following configuration, but it will still be printed?
Vue.config.productionTip = false
Vue.config.devtools= false
Vue.config.debug= false
1. Problem Analysis:
This is because after a vue project is packaged, the Javascript source code is usually merged and shrunk to optimize the site to load faster and reduce bandwidth usage. The compressed script is a file mapped from the transformed source to the original source, which allows the browser to reconstruct the original source and display the reconstructed original source to the debugger. In turn, to enable the debugger to use the source mapping, a source mapping file is generated and included in the converted file as a comment pointing to the source mapping file, as follows:
//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map
And when our vue project index.html or other entry interfaces to load some scripts into the project and packaged, these scripts will not produce the corresponding source mapping, but the mapping file (sourceMappingURL) is declared in the script, at this time the browser naturally throws an exception, so the console prints not the output of the project itself, but Chrome’s prompt!
2. Solution:
We just need to remove the above mentioned //# sourceMappingURL= xxxxxxx line from the corresponding statically introduced script, or download the corresponding source mapping file and place it in the directory where the corresponding script is located, depending on the boot version.
Read More:
- [Solved] devTools failed to load sourcemap: Could not parse content for map
- How to Solve React devtools plug-in Error
- [Solved] Uncaught (in promise) DOMException: Failed to load because no supported source was found.
- Solution to some map files in JS folder after Vue packaging (remove the map. JS file)
- How to Solve the error: initialize failed invalid dom
- [vite] Failed to parse source for import analysis because the content contains invalid JS syntax.
- [Solved] Failed to load config “prettier“ to extend from.?
- [Solved] Vue item packaging error: Failed to load resource: the server responded with a status of 404 (Not Found)
- [Solved] Failed to load config “react-app“ to extend from.
- How to Solve electron import page Error
- How to Solve VUE Error: Mixed spaces and tabs
- React: How to Solve Web3 import error
- [Solved] Vite Error: Failed to load module script: Expected a JavaScript module script but the server…
- Vue: How to Solve error avoided redundant navigation to current location: “/xxx”
- How to Solve QT uses MSVC compiler to code error
- How to Solve Vue loading 3D model Error
- How to Solve Vue cli syntax Close Error
- How to Solve Converting circular structure to JSON‘ Error
- Vue: How to Solve Eslint error
- [Solved] Failed to load plugin ‘vue‘ declared in ‘.eslintrc.js‘: createRequire is not a function