问题
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