注意:
我这里使用link标签引入的清除默认样式,如果是main.js通过import引入的话会报错
出现的问题:
Refused to apply style from 'http://localhost:8080/work/css/reset.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
解决的办法:
在<head></head>标签里面加一个<base href="/">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<base href="/"/>
<!-- 清楚默认样式 -->
<link rel="stylesheet" type="text/css" href="./css/reset.css">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>