javascript - es6 modules to commonjs with typescript under node harmony flag -


i'm using typescript (1.6) node under --harmony flag, i'd transpile es6 module syntax commonjs.

from can tell, can't typescript 1.6. if set target es6, , module commonjs, typescript error -

cannot compile modules 'commonjs', 'amd', 'system' or 'umd' when targeting 'es6' or higher.

why won't typescript compile commonjs es6 target? imagine lot people want since node doesn't support es6 modules yet.

i'd thought new moduleresolution compiler option might solve issue, doesn't appear anything.

currently, i'm having use babel transpile module syntax commonjs, i'd remove babel builds can take advantage of source maps.

is there way can achieve this? note: not want transpile es5. want js running es6 under harmony flag. thanks!

the typescript team add support looking in the next release. can wait few weeks/months. alternatively, can use polyfill es6 module loader:

there more libraries ones above available online check 1 job until official support --module --target es6 arrives.

update

tsconfig.json

{   "compileroptions": {     "target":"es6",     "moduleresolution": "classic",   } } 
  • es6 support generators
  • no import stuff transpiling due "moduleresolution": "classic"

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -