2017-01-28 15 views
7

Đó là tsconfig.js tôiKhông thể để tự động transpile ES mô-đun System.config ({transpile: 'transpile-mô-đun'})

{ 
"compilerOptions": { 
    "experimentalDecorators": true, 
    "emitDecoratorMetadata": true, 
    "moduleResolution": "node", 
    "target": "es5", 
    "module": "system", 
    "noImplicitAny": false, 
    "outDir": "built", 
    "rootDir": ".", 
    "sourceMap": false 
}, 
"exclude": [ 
    "node_modules" 
] 

}

tôi transpiling tôi 'hello-góc. ts 'thành' hello-angular.js 'bằng lệnh tsc. Và nhập khẩu bởi System.import ('built/hello-angular')

Khi im máy chủ bắt đầu tôi đã có err trong trình duyệt Unable to dynamically transpile ES module A loader plugin needs to be configured via SystemJS.config ({transpiler: 'transpiler-mô-đun'}) ` '

Tôi không hiểu, tại sao systemjs cố gắng để transpile tập tin ES5 .. tôi đã được thiết lập system.config ({transpiler: false}), nhưng nó didnt giúp ..

Trả lời

-1

Hãy thử như sau trong tsconfig.json của bạn:

"module": "commonjs", 
0

tôi đã nhận được cùng lỗi trên một trong các p lugins:

Lỗi: Không thể tự động transpile mô-đun ES Plugin trình tải cần được định cấu hình qua SystemJS.config({ transpiler: 'transpiler-module' }). instantiating http://localhost:62362/node_modules/angular-star-rating/index.js

giải quyết lỗi này bằng cách thay thế dòng này trong systemjs.config.js:

'angular-star-rating': { defaultExtension: 'js', main: 'index.js' } 

với dòng này:

'angular-star-rating': { defaultExtension: 'js', main: 'angular-star-rating.umd.js' } 
Các vấn đề liên quan