2017-06-10 5 views
0

私はtraceurとes6ローダーを使用していましたが、私はSystemjsに変更しました。System.paths [ 'jqueryの']は、私がメッセージを持っていた:System.paths ['jquery'] = './node_modules/jquery/dist/jquery.js'の使用時にエラー

Error: Cannot set SystemJS.paths["jquery"] directly. Use SystemJS.config({ paths: { "jquery": ... } }) rather

だから私は、に変更します。

System.config({ 
paths: { 
"jquery": "./node_modules/jquery/dist/jquery.js" 
}  
}); 
System.import('jquery'); 
System.import('src/app.js'); 

このエラーを表示:

system.js:4 Uncaught (in promise) Error: Fetch error: 404 Not Found 
system.js:4 Uncaught (in promise) Error: Unable to dynamically transpile ES module 
A loader plugin needs to be configured via `SystemJS.config({ transpiler: 'transpiler-module' })`. 

私が試みたが、うまくいきませんでした。

System.config({ 
transpiler: "babel", 
map: { 
"babel": "./node_modules/babel-core/lib/api/browser.js", 
"jquery": "./node_modules/jquery/dist/jquery.js" 
} 
}) 

エラー

system.js:4 Uncaught (in promise) Error: Fetch error: 404 Not Found 
Instantiating localhost:3000/node_modules/babel-core/lib/api/node 
Loading localhost:3000/node_modules/babel-core/lib/api/browser.js 
Loading babel 
Unable to load transpiler to transpile localhost:3000/src/app.js 

答えて

0

は、私はあなたがそれをtranspileしようとしないので、jQueryのグローバルなスクリプトとして追加する必要がありますsystemjsに通知する必要があると思います。以下を試してください:

System.config({ 
paths: { 
    "jquery": "./node_modules/jquery/dist/jquery.js" 
}, 
meta: { 
    "jquery": { "format": "global" } 
} 
}); 
+0

ありがとうございますが、jspmとplugin-babelをインストールして設定ファイルを作成しました。 System.config({ のbaseURL: "/"、 defaultExtensions:真、 transpiler: "バベル"、 パス:{ 'バベル':'jspm_packages/npm/[email protected]/plugin- jquery ':' ./ node_modules/jquery/jquery/jquery/jquery/jquery/jquery/jquery/jquery/jquery/jquery/jquery/jquery/jquery/dist/jquery.js ' } }); – gise

+0

すべてが必要なのかどうかわかりませんが、私が見つけたのは代わりのものでした。 – gise

関連する問題