Webpack是我长期以来看到的最令人沮丧的工具之一。它有环绕文件,非常不友好,非互动。如果失败 - 就像一个黑匣子 - 你无法与之互动并询问出了什么问题。Webpack试图加载一个模块,我没有要求它加载和失败。如何调试?
我有我的配置主要工作,但有一个恼人的警告,我不能摆脱。警告看起来好像有些模块试图require
index.html
和似乎是默认的JavaScript加载器就不能分析它:
WARNING in ./app/index.html
Module parse failed: /home/burkov/Documents/Projects/bostongene/workflows/workflows/workflows/frontend/app/index.html Line 1: Unexpected token <
You may need an appropriate loader to handle this file type.
| <html>
| <head>
| <base href="/">
@ ./app \.html$
我的配置已经index.html
明确排除ngtemplate
装载机:
...
module: {
...
loaders: [
...
{
test: /\.html$/,
exclude: `${path.join(__dirname, "/app/index.html")}`,
loaders: [`ngtemplate?relativeTo=${__dirname}`, "html"] //html?attrs[]=div:ng-include
}
]
}
没有这个排除我遇到类似this的错误。
。我想知道:
- 谁(哪行代码)试图加载
index.html
模块,导致警告? - 什么样的加载程序负责加载这个文件?