Angular2 WebPack相对CSS文件



我正在使用webpack使用angular2 cli,并尝试创建一个单独的单独模块,该模块包含一个相对路径CSS文件,而我在不使用完整路径的情况下无法使其工作。

我在这里遵循了文档,但仍然无法使用。https://angular.io/docs/ts/latest/cookbook/component-relative-paths.html

@Component({
    selector: 'mymodulecomponent',
    template: '<view></view>',
    styleUrls: ['./mystyle.component.scss']
})

有一些依赖性还是我会做什么错?

我最终想为NPM构建,因此,如果还有另一种包含CC文件的方法,我将打开。

添加一个模块ID,例如:

@Component({
    moduleId: module.id,
    selector: 'mymodulecomponent',
    template: '<view></view>',
    styleUrls: ['./mystyle.component.scss']
})

另请参见:angular2-组件中模块的含义是什么?

最新更新