Refused to apply ** from ‘url‘ because its MIME type (‘text/html‘) is not a supported ** MIME type,

1. Project environment version

  • @vue/cli-service: ‘~5.0.0’

2. Problem description

Execute buildscript packaging, compile, visit indexm.htmlthe page, and report an error.

insert image description here

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.

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
    insert image description here
    , so I suspect that it is a static file publicPathconfiguration problem.
  • Open vue.config.jsthe file.
    insert image description here

Add in configuration

  publicPath: './'

Change the request path of static resources to a relative path.

  • Pack again, problem solved.
    insert image description here

Guess you like

Origin blog.csdn.net/u010657801/article/details/131781431