I'm running: ts-node --project ./tsconfig.json downloadImages.ts
// tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"baseUrl": ".",
"lib": [
"dom",
"es2015",
"es2016",
"es2017.object"
]
}
}
I'm getting:
(function (exports, require, module, __filename, __dirname) { import request from 'request-promise';
^^^^^^^
SyntaxError: Unexpected identifier
I must be doing something wrong about declaring that the file is defined as ES6 code.
I changed compilerOptiosn to
{
...
"target": "es6",
"module": "esnext",// Deleted
...
}
and now it works.
Most helpful comment
I changed compilerOptiosn to
and now it works.