webpack - CSS 未包含在 index.html 中
问题描述
我有一些 CSS 规则,其中之一是:
{
test: /\.css$/,
use: [{ loader: 'style-loader/url' }, { loader: 'file-loader' }],
include: [require.resolve('normalize.css')],
},
该规则非常具体,仅匹配单个导入,即在我的内部我index.js
有一个导入:
import 'normalize.css';
当我构建(使用 WebPack 4)时,我在输出中看到index.html
多个:
<link href="/2.03ec883f8c956db4d531.css" rel="stylesheet">
<link href="/0.6e0b40d9554f38994c59.css" rel="stylesheet">
对于其他 css 规则,但没有对normalize.css
bundle 的引用。它在dist
文件名为fda27b856c2e3cada6e0f6bfeccc2067.css
(nicely minimized, and this file only contains normalize.css) 的文件夹中可用,但fda27b856c2e3cada6e0f6bfeccc2067.css
在index.html
.
我该如何解决?
解决方案
推荐阅读
- java - 如何在属性中显示json数据
- python - 如何提取正则表达式查询直到特定单词?
- google-cloud-firestore - 同一个 Firestore 集合上的多个触发器
- python-3.x - 选择“student_id”,其中“pass”值在每种情况下都不为 0
- hadoop-yarn - 如何杀死 YARN 容器以测试失败场景
- batch-file - 如何将错误消息从批处理文件传递到团队城市
- java - 在多对多表、休眠、弹簧中保存数据的问题
- python - 是否可以防止迭代器到达文件末尾?
- azure-logic-apps - EventGrid 触发器 - 如何从 triggerbody 设置 clienttrackingid?
- jquery - jQuery在新行中追加文本但br标签不起作用