Aurelia with ASP.NET Core 2.0: Unable to find module with ID: resources/index

倖福魔咒の 提交于 2019-12-11 07:32:53

问题


I created a Visual Studio 2017 ASP.NET Core 2.0 solution by using the SPA Aurelia template. Everything works fine so far but I don't get the configuration (in "boot.ts") to find my "resources/elements" folder (or it's index.ts):

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

"Unable to find module with ID: resources/index at WebpackLoader. (aurelia-loader-webpack.js:187)"

The index.ts:

import { FrameworkConfiguration } from 'aurelia-framework';

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

The solution structure:


回答1:


I had to change

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

to

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

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

and

import { FrameworkConfiguration } from 'aurelia-framework';

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

to

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

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

and also

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

to

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

;)



来源:https://stackoverflow.com/questions/46593108/aurelia-with-asp-net-core-2-0-unable-to-find-module-with-id-resources-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!