【发布时间】:2017-01-15 05:59:46
【问题描述】:
所以我在一个有几个外部依赖项的 Angular2 项目上使用 webpack2。其中一些依赖项使用了 commonjs,并声明了如下组件:
@Component({
moduleId: module.id,
templateUrl: 'mycomponent.html'
...
})
这会导致以下错误:
Error: moduleId should be a string in "MyComponent"
经过一番研究,我发现这是因为 Webpack 期望组件将 id 作为数字,而 Angular 将其声明为字符串。我无法更改依赖代码。我该怎么做才能忍受这种依赖?
谢谢!
【问题讨论】: