Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Angular@ngtools/webpack生成在使用webpack模式时失败';生产';_Javascript_Angular_Webpack_Ngtools - Fatal编程技术网

Javascript Angular@ngtools/webpack生成在使用webpack模式时失败';生产';

Javascript Angular@ngtools/webpack生成在使用webpack模式时失败';生产';,javascript,angular,webpack,ngtools,Javascript,Angular,Webpack,Ngtools,我一直有这个问题,我一开始 {mode:'production'} 在我的webpack.config.jsmy Angular templates中,使用 @Component({templateUrl:'path/to/template.html'}) 无法再进行编译 产生的错误都与模板中使用的指令有关,例如 src/path/to/template.html:1:123 - error NG8002: Can't bind to 'routerlink' since it isn't

我一直有这个问题,我一开始

{mode:'production'}
在我的
webpack.config.js
my Angular templates中,使用

@Component({templateUrl:'path/to/template.html'})
无法再进行编译

产生的错误都与模板中使用的指令有关,例如

src/path/to/template.html:1:123 - error NG8002: Can't bind to 'routerlink' since it isn't a known property of 'a'

事实证明,这个错误提供的信息比看上去的要多。问题实际上是,它已从
routerLink
更改为
routerLink

当生产模式处于活动状态时,
html加载程序
将启用它的最小值。由于加载程序用于在传递给Angular编译器之前获取模板,因此会设置错误

解决此问题的最简单方法是将
html加载程序的
caseSensitive
选项设置为
true

{
模块:{
规则:[
{
测试:/\.html$/,,
使用:[
{
加载器:“html加载器”,
选项:{minimize:{区分大小写:true}}
}
]
}
]
}
}
我在这里记录了这些,所以我希望在2到3年后搜索时能找到它