使用ASP.NET Core 2.0的Aurelia:无法找到ID为:resources / index的模块

时间:2017-10-05 19:09:09

标签: webpack aurelia asp.net-core-2.0

我使用SPA Aurelia模板创建了Visual Studio 2017 ASP.NET Core 2.0解决方案。到目前为止一切正常但我没有得到配置(在“boot.ts”中)来查找我的“resources / elements”文件夹(或者它的index.ts):

export function configure(aurelia: Aurelia) {
    aurelia.use
        .standardConfiguration()
        .feature(PLATFORM.moduleName('resources'));
  

“无法找到ID为:资源/索引的模块   在WebpackLoader。 (Aurelia路上-架webpack.js:187)“

index.ts:

import { FrameworkConfiguration } from 'aurelia-framework';

export function configure(config: FrameworkConfiguration) {
    config.globalResources(['./elements/loading-indicator']);
}

解决方案结构:

enter image description here

1 个答案:

答案 0 :(得分:1)

我不得不改变

.feature(PLATFORM.moduleName('resources'));

.feature(PLATFORM.moduleName('resources/index'));

https://github.com/aurelia/webpack-plugin/issues/108

import { FrameworkConfiguration } from 'aurelia-framework';

export function configure(config: FrameworkConfiguration) {
    config.globalResources([
        './elements/loading-indicator'
    ]);
}

import { FrameworkConfiguration, PLATFORM } from 'aurelia-framework';

export function configure(config: FrameworkConfiguration) {
    config.globalResources([
        PLATFORM.moduleName('./elements/loading-indicator')
    ]);
}

以及

@noView([ 'nprogress/nprogress.css' ])
export class LoadingIndicator {
...
}

@noView([ PLATFORM.moduleName('nprogress/nprogress.css') ])
export class LoadingIndicator {
...
}