繁体   English   中英

加载模块脚本失败:服务器以非 JavaScript、CSS MIME 类型“text/x-scss”响应

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

各位,

我收到了教授的一些代码。 在本地运行 liveserver 时,js 在浏览器终端中给我一个错误。

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.

我从未在 javascript 中实现 css 文件,而且我从未使用过 scss,所以我不知道如何解决这个问题。 我希望这里有人知道如何帮助我。

问候

您需要使用 node-sass 或 webpack 之类的工具将 scss 文件编译为 css,然后在您的项目中引用它。

https://sass-lang.com/guide

sass 在发送到浏览器之前使用编译器编译为 css。 浏览器不知道如何处理 scss 文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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