Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 830
Oleg Rasskazov Avatar asked Jan 28 '17 21:01

Oleg Rasskazov


2 Answers

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',
like image 79
Todd Palmer Avatar answered Oct 31 '22 03:10

Todd Palmer


Try the following in your tsconfig.json:

"module": "commonjs",
like image 28
pixelbits Avatar answered Oct 31 '22 04:10

pixelbits