简体   繁体   中英

Failed to load module script: The server responded with a non-JavaScript, CSS MIME type of “text/x-scss”

Hery guys,

I received a bit of code by my professor. When running the liveserver localy, the js is giving me an error in the browser terminal.

Failed to load module script: The server responded with a non-JavaScript, CSS MIME type of "text/x-scss". Strict MIME type checking is enforced for module scripts per HTML spec.

I have never implemented css files in the javascript and I never used scss so I dont know how to work with this issue. I hope someone here knows how to help me.

greetings

You will need to use a tool like node-sass or webpack to compile the scss file into css, and then reference that in your project.

https://sass-lang.com/guide

sass is compiled to css using a compiler before being sent to the browser. Browsers don't know what to do with scss files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM