Error message
Use the white screen of the web page packaged by vite, and the console reports an error.
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec.
reason
MIME type errors are generally a problem with native windows development. I encountered this after opening it with Python’s built-in http.server on Windows.
Solution
Deploy the packaged files in a formal server environment (such as nginx and Apache)
Read More:
- [Solved] Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs extension
- [Solution] VUE.js Load a local image with parameters in the script
- ArcGIS API for JavaScript version 4. X updated and the project startup error: Module parse failed: Unexpected token(… …
- [Solved] arco design vite-plugin-style-import Load menu-item error: Internal server error…
- [Solved] VS Code Debug JavaScript Error: “crbug/1173575, non-JS module files deprecated”
- [Solved] vue3vite Error: Failed to resolve import “@vue/server-renderer from “src\App.vue“. Does the file exist
- How to Solve Bat Script Error: system error 85 has occurred
- Vue Project Error: Expected indentation of 2 spaces but found 4,Newline required at end of file but not found
- Bugly automatically upload script and report zip error: nothing to do! In xcode10
- [Solved] VUE eslint Error: Expected linebreaks to be ‘LF‘ but found ‘CRLF
- [Solved] Vue 3 Script Setup ESLint Error: ‘defineProps‘ is not defined
- Module build failed: Error: Couldn’t find preset “es2015” relative to directory
- [Solved] 20:1 error Expected indentation of 2 spaces but found 4 indent 21:1 error Expected indent
- [Solved] Vue item packaging error: Failed to load resource: the server responded with a status of 404 (Not Found)
- [Solved] Vue Less error: Webpack project report expected indentation of 0 spaces but found 2
- [Solved] Vue calls style loader error: Module build failed: CssSyntaxError
- [Solved] VUE npm install Error: Module build failed: Error: ENOENT: no such file or directory, scandir
- [Solved] Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘
- [Solved] Module build failed: Error: Vue packages version mismatch
- [Solved] Vue Error: Module build failed Error Node Sass version 6.0.1 is incompatible with ^4.0.0.