我正在將現有的Aurelia應用程序從JSPM/SystemJS移植到Aurelia CLI。Aurelia CLI,babel運行時和異步轉換
我在遇到問題babel-runtime
和相關轉換工作au build
時遇到問題。我認爲這個問題是由於aurelia.json
所需的babel-runtime
依賴 - 我不能工作了,應該是什麼樣,現在它看起來像下面這樣:
...
{
"name": "babel-runtime",
"path": "../node_modules/babel-runtime",
"main": "core-js",
"resources": [
"./regenerator/index.js"
]
}
...
我有以下的(相關)devDependencies :
...
"babel-plugin-syntax-flow": "^6.8.0",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-modules-amd": "^6.8.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.10.3",
"babel-plugin-transform-es2015-modules-systemjs": "^6.9.0",
"babel-plugin-transform-flow-strip-types": "^6.8.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-stage-1": "^6.5.0",
"babel-register": "^6.9.0"
...
和(相關)的依賴性:
"babel-runtime": "^6.23.0",
而且我.babelrc
:
{
"sourceMap": true,
"moduleIds": false,
"comments": false,
"compact": false,
"code": true,
"presets": [
["es2015", {"loose": true}],
"stage-1"
],
"plugins": [
"syntax-flow",
"transform-decorators-legacy",
"transform-async-to-generator",
["transform-runtime", {
"polyfill": false,
"regenerator": true
}],
"transform-flow-strip-types",
["transform-builtin-extend", {
"globals": ["Array"]
}]
]
}
在au build
我收到以下錯誤類:
File not found or not accessible: D:/code/.../node_modules/babel-runtime/regenerator.js. Requested by D:\code\...
File not found or not accessible: D:/code/.../node_modules/core-js/library/fn/symbol.js. Requested by D:\code\...
可能有人誰已經成功地建立了babel-runtime
在奧裏利亞CLI應用程序,請幫助?
更新
我設法構建由列出所有babel-runtime
和core-js
依賴性,它似乎引用工作.... 這是正確的做法?
{
"name": "babel-runtime",
"path": "../node_modules/babel-runtime",
"main": "core-js"
},
{
"name": "babel-runtime/regenerator",
"path": "../node_modules/babel-runtime/regenerator",
"main": "index"
},
{
"name": "babel-runtime/core-js",
"path": "../node_modules/babel-runtime/core-js"
},
{
"name": "core-js",
"path": "../node_modules/core-js",
"main": "index"
},
{
"name": "core-js/library",
"path": "../node_modules/core-js/library",
"main": "index"
},
{
"name": "regenerator-runtime",
"path": "../node_modules/regenerator-runtime",
"main": "runtime-module"
},
...
但是我現在看到需要運行時錯誤,這似乎表明,我的依賴不會被加載正確的順序
Uncaught Error: Module name "_export" has not been loaded yet for context: _. Use require([])
Uncaught Error: Module name "shim" has not been loaded yet for context: _. Use require([])
任何人都可以在這方面幫助?
你實際上沒有告訴我們出了什麼問題。 – loganfsmyth
@loganfsmyth抱歉只是注意到並更新了!謝謝 –
確保你正在加載的庫(babel-runtime)在AMD中。它看起來也許它有一些奇怪的語法,它用來加載依賴關係... – Andrew