1. Project environment version
@vue/cli-service
: ‘~5.0.0’
2. Problem description
Execute build
script packaging, compile, visit indexm.html
the page, and report an error.
Failed to load resource: the server responded with a status of 404 (Not Found)
Refused to execute script from 'http://localhost:63342/js/chunk-vendors.f1ad1f4f.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Failed to load resource: the server responded with a status of 404 (Not Found)
Refused to execute script from 'http://localhost:63342/js/app.1657eaa6.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to apply style from 'http://localhost:63342/css/app.fe9f3cca.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
3. Solutions
- Right-click any address in the above error report, click
Open in new tab
, and find that the access result is 404
, so I suspect that it is a static filepublicPath
configuration problem. - Open
vue.config.js
the file.
Add in configuration
publicPath: './'
Change the request path of static resources to a relative path.
- Pack again, problem solved.