问题:学习webpack时想要引入一个css文件,配置好css-loader和style-loader后使用命令npx webpack和npx webpack-dev-server后发现css文件没有生效,控制台报错:
Refused to apply style from 'http://localhost:8082/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
原因:引入方式错误。我在html文件中直接使用<link rel="stylesheet" href="./style.css">来引入,应当在js文件中使用import引入。