0
我嘗試biuld沒有完整的文檔的旁邊奧裏利亞插件,我讀太多的doc和插件IM構建一個簡單的插件,它包含一個簡單的日期選擇器:在奧裏利亞創建功能
首先我創建以下文件系統:
./Aurelia
-JbPlugin
-JbDirectives
+index.js
+jb-calendar.js
和main.js文件我功能添加它象下面這樣:
aurelia.use
.standardConfiguration()
.developmentLogging()
.feature('jb-directive');
後,在插件的index.js文件我有:
import {ViewLocator , inject} from 'aurelia-framework';
import {JbCalendar} from './jb-calendar';
export function configure(config) {
config.globalResources([
'./jb-calendar']
);
}
export {
JbCalendar,
};
:
import {inject, bindable, bindingMode, BindingEngine} from 'aurelia-framework';
@inject(BindingEngine)
export class JbCalendar {
}
在我的config.js文件:
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system",
"es7.decorators",
"es7.classProperties"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*",
"jb-plugin:*":"Aurelia/JbPlugin/*"
},
stage: 0,
map: {
"jb-directive": "jb-plugin:jb-directive",
"aurelia-animator-css": "npm:[email protected]",
"aurelia-bootstrapper": "npm:[email protected]",
"aurelia-fetch-client": "npm:[email protected]",
"aurelia-framework": "npm:[email protected]",
"aurelia-http-client": "npm:[email protected]",
"aurelia-pal-browser": "npm:[email protected]",
"aurelia-router": "npm:[email protected]",
"babel": "npm:[email protected]",
"babel-polyfill": "npm:[email protected]",
"babel-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]",
"jquery": "npm:[email protected]",
"github:jspm/[email protected]": {
"assert": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"buffer": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"path-browserify": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"process": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"util": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"vm-browserify": "npm:[email protected]"
},
"npm:[email protected]": {
"assert": "github:jspm/[email protected]",
"buffer": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"util": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-event-aggregator": "npm:[email protected]",
"aurelia-framework": "npm:[email protected]",
"aurelia-history": "npm:[email protected]",
"aurelia-history-browser": "npm:[email protected]",
"aurelia-loader-default": "npm:[email protected]",
"aurelia-logging-console": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-pal-browser": "npm:[email protected]",
"aurelia-polyfills": "npm:[email protected]",
"aurelia-router": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]",
"aurelia-templating-binding": "npm:[email protected]",
"aurelia-templating-resources": "npm:[email protected]",
"aurelia-templating-router": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-history": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-loader": "npm:[email protected]",
"aurelia-metadata": "npm:aurelia-m[email protected]",
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-metadata": "npm:[email protected]",
"aurelia-path": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-logging": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-path": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-event-aggregator": "npm:[email protected]",
"aurelia-history": "npm:[email protected]",
"aurelia-logging": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-route-recognizer": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-logging": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-router": "npm:[email protected]",
"aurelia-templating": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected]",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected]",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]"
},
"npm:[email protected]": {
"babel-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]",
"fs": "github:jspm/[email protected]",
"path": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"regenerator-runtime": "npm:[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"core-js": "npm:[email protected]",
"regenerator-runtime": "npm:[email protected]"
},
"npm:[email protected]": {
"base64-js": "npm:[email protected]",
"child_process": "github:jspm/[email protected]",
"fs": "github:jspm/[email protected]",
"ieee754": "npm:[email protected]",
"isarray": "npm:[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:core[email protected]": {
"fs": "github:jspm/[email protected]",
"path": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"fs": "github:jspm/[email protected]",
"path": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"util": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"assert": "github:jspm/[email protected]",
"fs": "github:jspm/[email protected]",
"vm": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"path": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"inherits": "npm:[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"indexof": "npm:[email protected]"
}
}
});
我有:
{
"jspm": {
"main": "index",
"format": "amd",
"dependencies": {
"aurelia-animator-css": "npm:[email protected]^1.0.1",
"aurelia-bootstrapper": "npm:[email protected]^2.0.1",
"aurelia-fetch-client": "npm:[email protected]^1.1.0",
"aurelia-framework": "npm:[email protected]^1.0.8",
"aurelia-http-client": "npm:[email protected]^1.0.4",
"aurelia-pal-browser": "npm:[email protected]^1.1.0",
"aurelia-router": "npm:[email protected]^1.1.1",
"babel-polyfill": "npm:[email protected]^6.23.0",
"jquery": "npm:[email protected]^3.1.1",
"jb-directive": "jb-plugin:jb-directive"
},
"devDependencies": {
"babel": "npm:[email protected]^5.8.24",
"babel-runtime": "npm:[email protected]^5.8.24",
"core-js": "npm:[email protected]^1.1.4"
}
}
}
所以它沒有任何錯誤很好地工作,並加載所有的JS,但是當我想使用像儀表板js這樣的真實課程插件如下:
import {JbCalendar} from 'jb-directive';
它拋出一個錯誤對我說:
GET http://localhost:9001/Aurelia/JbPlugin/jb-directive.js 404 (Not Found)
爲什麼奧裏利亞航線插件像頂部犯規它soppose加載index.js文件?
編輯: 我findout我的插件是做工精細什麼,我需要的只是用指令沒有任何同類「進口」監守我在全球資源加我的指令,它可以反正在應用程序中使用,而不進口
沒有問題仍然存在,它尋找JB-directive.js或jbDirective.js –
GET HTTP://本地主機:9001 /奧裏利亞/ JbPlugin/jbDirective.js 404(未找到) –
他創造一個插件,而不是一個功能,所以他需要使用'plugin'功能。 –