Problem Description:
After vite project build is deployed, the following error messages appear when accessing in the browser:
Expected a JavaScript module script but the server responded with a MIME type of "text/html"
Strict MIME type checking is enforced for module scripts per HTML spec.
Solution:
The reason for the above problem is that the correct static resource path is not found after the project is built. The solution is as follows
// In the vite.config.js directory, modify the following. export default viteConfig = { base: '/' }
Similar Posts:
- Solve the problem of JS using JSX syntax to report errors in vite react project
- Solution to unknown media type in type * * / * * when installing DEB package
- [Solved] Vue cli 3.0 error: “Failed to load resource: net::ERR_FILE_NOT_FOUND”
- Vue Use the top-level await Error [How to Solve]
- Webpack 4 : ERROR in Entry module not found: Error: Can’t resolve ‘./src’
- Stylesheet not loaded because of MIME-type [How to Solve]
- When vue3 + vite loads a route, an error occurs. Net:: err_ ABORTED 500 (Internal Server Error)
- The solution of Python extension problem “unable to find vcvarsall. Bat”
- Resource interpreted as Stylesheet but transferred with MIME type text/html: css not work