我正在使用修改过的aurelia-navigation-skeleton来构建我的项目(修改后因为我还添加了一个服务栈后端)。
首先是错误:
[16:33:59] Error tracing npm:crypto-browserify@3.11.0/example/bundle.js at file:///C:/MyProjectPath/jspm_packages/npm/crypto-browserify@3.11.0/example/bundle.js
Error: Unable to calculate canonical name to bundle file:///test.js. Ensure that this module sits within the baseURL or a wildcard path config.
at getCanonicalNamePlain (C:\MyProjectPath\node_modules\systemjs-builder\lib\utils.js:227:13)
at getCanonicalName (C:\MyProjectPath\node_modules\systemjs-builder\lib\utils.js:150:19)
at C:\MyProjectPath\node_modules\systemjs-builder\lib\trace.js:565:36
at run (C:\MyProjectPath\node_modules\karma\node_modules\core-js\modules\es6.promise.js:87:22)
at C:\MyProjectPath\node_modules\karma\node_modules\core-js\modules\es6.promise.js:100:28
at flush (C:\MyProjectPath\node_modules\karma\node_modules\core-js\modules\_microtask.js:18:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
我自己并没有使用crpto-browserify所以我认为它是在骨架内或Aurelia本身内的某个依赖。
项目布局:
ProjectRoot
-- build (from skeleton)
-- tasks
-- src (standard aurelia layout here)
-- app.js/main.js/app.html
-- views
-- resources
-- etc...
-- default.html
-- node_modules
-- jspm_packages
-- jspm.config.js
-- package.json
jspm.config.js
System.config({
defaultJSExtensions: true,
transpiler: "typescript",
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
map: {
"aurelia-animator-css": "npm:aurelia-animator-css@1.0.1",
"aurelia-api": "npm:aurelia-api@3.1.1",
"aurelia-authentication": "npm:aurelia-authentication@3.3.0",
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@2.1.1",
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.3.0",
"aurelia-dialog": "npm:aurelia-dialog@1.0.0-beta.3.0.1",
"aurelia-fetch-client": "npm:aurelia-fetch-client@1.1.1",
"aurelia-framework": "npm:aurelia-framework@1.1.0",
"aurelia-pal-browser": "npm:aurelia-pal-browser@1.1.0",
"aurelia-router": "npm:aurelia-router@1.2.1",
"aurelia-templating-binding": "npm:aurelia-templating-binding@1.3.0",
"bootstrap": "github:twbs/bootstrap@3.3.7",
"font-awesome": "npm:font-awesome@4.7.0",
"moment": "npm:moment@2.17.1",
"numeral": "npm:numeral@2.0.4",
"servicestack-client": "npm:servicestack-client@0.0.26",
"text": "github:systemjs/plugin-text@0.0.9",
"typescript": "npm:typescript@2.2.1",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.4.1"
},
...
...
...
}
bundle.js
var gulp = require('gulp');
var bundler = require('aurelia-bundler');
var bundles = require('../bundles.js');
var config = {
force: true,
baseURL: '.',
configPath: './jspm.config.js',
bundles: bundles.bundles
};
gulp.task('bundle', ['build'], function() {
return bundler.bundle(config);
});
gulp.task('unbundle', function() {
return bundler.unbundle(config);
});
bundles.js
module.exports = {
"force": true,
"packagePath": ".",
"configPath": [ // SystemJS/JSPM configuration files
"./jspm.config.js"
],
"injectionConfigPath": "./jspm.config.js",
"bundles": {
"dist/app-build": {
"includes": [
"[**/*.js]",
"**/*.html!text",
"**/*.css!text"
],
"options": {
"inject": true,
"minify": true,
"depCache": false,
"rev": true
}
},
"dist/aurelia": {
"includes": [
"aurelia-api",
"aurelia-authentication",
"aurelia-framework",
"aurelia-pal-browser",
"aurelia-bootstrapper",
"aurelia-dependency-injection",
"aurelia-dialog",
"aurelia-fetch-client",
"aurelia-router",
"aurelia-animator-css",
"aurelia-templating-binding",
"aurelia-polyfills",
"aurelia-templating-binding",
"aurelia-templating-resources",
"aurelia-templating-router",
"aurelia-loader-default",
"aurelia-history-browser",
"aurelia-logging-console",
"moment",
"numeral",
"servicestack-client",
"bootstrap",
"bootstrap/css/bootstrap.css!text"
],
"options": {
"inject": true,
"minify": true,
"depCache": false,
"rev": true
}
}
}
};
错误对我没有任何意义,其他关于此错误的帖子谈论更改BaseURL,但我不知道我会改变它以使其工作。任何帮助将不胜感激。