Oleg Rasskazov
Oleg Rasskazov

Reputation: 71

Unable to dynamically transpile ES module System.config({ transpile: 'transpile-module'})

It's my tsconfig.js

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

}

i'm transpiling my 'hello-angular.ts' into 'hello-angular.js' using tsc command. And import by System.import ('built/hello-angular')

When im starting server i've got err in browser Unable to dynamically transpile ES module A loader plugin needs to be configured viaSystemJS.config({ transpiler: 'transpiler-module' })``

I'm dont understand, why systemjs trying to transpile es5 file.. I was set system.config({transpiler: false}) , but it didnt help..

Upvotes: 7

Views: 10161

Answers (3)

Todd Palmer
Todd Palmer

Reputation: 1102

You need to add a transpiler as noted in the following answer:

Angular 2 - Unable to dynamically transpile ES module, angular2-google-map-auto-complete

In mine it looks like this in systemjs.config.js:

map: {
  'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js',
  'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js'
},
transpiler: 'plugin-babel',

Upvotes: 4

Dipendu Paul
Dipendu Paul

Reputation: 2753

I was getting same error on one of the plugins:

Error: Unable to dynamically transpile ES module A loader plugin needs to be configured via SystemJS.config({ transpiler: 'transpiler-module' }). Instantiating http://localhost:62362/node_modules/angular-star-rating/index.js

Resolved this error by replacing this line in systemjs.config.js:

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

with this line:

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

Upvotes: 0

Michael Kang
Michael Kang

Reputation: 52837

Try the following in your tsconfig.json:

"module": "commonjs",

Upvotes: 1

Related Questions