【发布时间】:2020-08-16 19:03:17
【问题描述】:
运行我自己的 Angular 应用程序非常新。我正在使用this guide 通过 webpack 设置 haml 加载,但它非常旧,ngx 不再支持弹出,所以我正在尝试使用 this package 进行一些自定义 webpack 配置。
我在编译时遇到这个错误:
ERROR in Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> %header
| test
这是我的 angular.json 中与自定义 webpack 相关的部分:
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./extra-webpack.config.js",
"mergeStrategies": {
"externals": "replace"
}
},
还有额外的webpack.config.js:
const path = require('path');
module.exports = {
module: {
rules: [
{ test: /\.haml$/, loader: 'haml-haml' }
]
}
};
编辑:不知道如何为此设置小提琴或 stackblitz,但我有一个新的 repo 可以复制问题:https://github.com/jugglervr/haml-test
【问题讨论】:
-
您的实现看起来不错。您可以尝试设置并共享一个可以复制的小型 repo 吗?
-
repo 设置并在最小问题中链接。谢谢你的建议!