我有一个有效的角度2网站,使用webpack打包资源。这个包几乎(现在)我使用dotnet new angular
命令生成的内容。
我已经添加了一些要包装的资源,但它们运行良好。
但是现在我在webpack.config.vendor.js
的入口供应商列表中添加了一个图标库的CSS文件:
entry: {
vendor: [
//[...all others...]
'icon-sets/icons/solid-icons/premium-solid-icons.min.css',
]
},
我运行了webpack:
webpack --config webpack.config.vendor.js
(没有错误),我构建并启动网站,然后我直接收到错误:
Exception: Call to Node module failed with error: Prerendering failed because of error: TypeError: __webpack_require__(...) is not a function at Object.<anonymous>
(E:\My\Project\ClientApp\dist\main-server.js:380:50) at __webpack_require__ (E:\My\Project\ClientApp\dist\main-server.js:20:30)
at Object.<anonymous> (E:\My\Project\ClientApp\dist\main-server.js:1636:22)
at __webpack_require__ (E:\My\Project\ClientApp\dist\main-server.js:20:30)
at Object.c (E:\My\Project\ClientApp\dist\main-server.js:256:18)
at __webpack_require__ (E:\My\Project\ClientApp\dist\main-server.js:20:30)
at Object.<anonymous> (E:\My\Project\ClientApp\dist\main-server.js:153:23)
at __webpack_require__ (E:\My\Project\ClientApp\dist\main-server.js:20:30)
at Object.<anonymous> (E:\My\Project\ClientApp\dist\main-server.js:349:20)
at __webpack_require__ (E:\My\Project\ClientApp\dist\main-server.js:20:30)
at E:\My\Project\ClientApp\dist\main-server.js:66:18
at Object.<anonymous> (E:\My\Project\ClientApp\dist\main-server.js:69:10)
at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32) Current directory is: E:\My\Project
我的理解是.Net尝试预渲染一些东西并因webpack而失败,但不知道为什么以及如何解决它。
有什么想法吗?