2017-04-06 12 views
0

私は、既存のAureliaアプリケーションをJSPM/SystemJSからAurelia CLIに移植しています。Aurelia CLI、babelランタイムと非同期変換

babel-runtimeと関連する変換をau buildで使用するのに問題があります。私は、次の(関連)devDependenciesを持って

... 
{ 
    "name": "babel-runtime", 
    "path": "../node_modules/babel-runtime", 
    "main": "core-js", 
    "resources": [ 
    "./regenerator/index.js" 
    ] 
} 
... 

:私はそれがどうあるべきかうまくいかないことができ、現在、それは次のようになります - 私は問題が原因aurelia.jsonに必要なbabel-runtime依存関係にあると思い

... 
"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", 

そして、私の.babelrcau buildオン

{ 
    "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"] 
    }] 
    ] 
} 

私は、エラーの次のクラスを取得:

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\... 

が正常アウレリアCLIアプリでbabel-runtimeを設定している誰かが助けてくださいもらえますか?私はそれを参照するように思えるすべてbabel-runtimecore-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([]) 

にロードされていないことを示しているように見える必要からランタイムエラーを参照してください?

+1

あなたは実際に何がうまくいかないか、私たちに語ったことはありません。 – loganfsmyth

+0

@loganfsmythすみませんが気づき、更新しました!ありがとう –

+0

ロードしようとしているライブラリ(babel-runtime)がAMDであることを確認してください。それは、おそらくそれは依存関係を読み込むために使用しているいくつかの奇妙な構文を持っているようだ... – Andrew

答えて

1

私はこれを動作させることができました....私は空のスレートから始まり、1つずつ動いている部分を追加しましたが、Aurelia CLIのアップデートもいくつかありましたので、それが私が間違っていたものだった場合、またはCLIに解決された問題があった場合。

マイ.babelrcは、ステージ1のプリセットは、非同期の仕事を変換させるのに十分なを持って、今非常に簡単です:

{ 
    "sourceMap": true, 
    "moduleIds": false, 
    "comments": false, 
    "compact": false, 
    "code": true, 
    "presets": [ 
    ["es2015", {"loose": true}], 
    "stage-1" 
    ], 
    "plugins": [ 
    "transform-runtime", 
    "transform-decorators-legacy" 
    ] 
} 

aurelia.jsoncore-jsbabel-runtime関連のバンドルの依存関係は次のとおりです。

"dependencies": [ 
    { 
    "name": "core-js", 
    "path": "../node_modules/core-js", 
    "main": "client/core", 
    "deps":[ 
     "../node_modules/core-js/shim", 
     "../node_modules/core-js/library/**/*.js", 
     "../node_modules/core-js/modules/**/*.js" 
    ] 
    }, 
    { 
    "name": "regenerator-runtime", 
    "path": "../node_modules/regenerator-runtime", 
    "main": "runtime" 
    }, 
    { 
    "name": "babel-runtime", 
    "path": "../node_modules/babel-runtime", 
    "main": "regenerator/index", 
    "deps": [ 
     "../node_modules/babel-runtime/core-js/**/*.js", 
     "../node_modules/babel-runtime/helpers/**/*.js" 
    ] 
    }, 
    { 
    "name": "babel-runtime/regenerator", 
    "path": "../node_modules/babel-runtime/regenerator", 
    "main": "index" 
    }, 

    ... 

そして、package.json関連ビット:

"dependencies": { 
    ... 
    "babel-runtime": "^6.23.0", 
    "core-js": "^2.4.1", 
    ... 
    }, 
    "devDependencies": { 
    ... 
    "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-runtime": "^6.23.0", 
    "babel-preset-es2015": "^6.13.2", 
    "babel-preset-stage-1": "^6.5.0", 
    .... 
    } 

これは誰でもこの仕事をしようとしています。

関連する問題