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
模塊,導致警告? - 什麼樣的加載程序負責加載這個文件?