Reputation: 615
Got a situation here.
I use nodejs with --harmony
flag to get support of generators.
Next i'm trying to switch my project to TypeScript and get a problem: in "target":"ES6"
mode it transpiles import
commands as is (instead of require
).
And node with --harmony
flag doesn't support that:
import * as fs from 'fs';
^^^^^^
SyntaxError: Unexpected reserved word
Transpiling option "module":"commonjs
isn't allowed with "target":"ES6"
.
Have anyone solved this problem without using any external require/import utilities?
Upvotes: 3
Views: 1613
Reputation: 615
Another way to get all i want is a build stack:
Upvotes: 0
Reputation: 615
These settings have worked for me:
tsconfig.json
{
"compilerOptions": {
"target":"ES6",
"moduleResolution": "classic",
}
}
import
stuff transpiling due to
"moduleResolution": "classic"
And so the problem's gone!
Upvotes: 3
Reputation: 24979
As you can see in the TypeScript roadmap (Version 1.7) one of the current issues is "Support --module with --target es6".
I'm afraid your are going to need a temporal solution until TypeScript 1.7 is released. Maybe Polyfill for the ES6 Module Loader or SystemJS?
Upvotes: 1