Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Cannot use import statement outside a module #256

Open
aryeh-luwfy opened this issue Dec 23, 2019 · 1 comment
Open

Cannot use import statement outside a module #256

aryeh-luwfy opened this issue Dec 23, 2019 · 1 comment

Comments

@aryeh-luwfy
Copy link

compiling error in file inside folder in src directory

[Node] SyntaxError: Cannot use import statement outside a module
[Node]     at Module._compile (internal/modules/cjs/loader.js:892:18)
[Node]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
[Node]     at Module.load (internal/modules/cjs/loader.js:812:32)
[Node]     at Function.Module._load (internal/modules/cjs/loader.js:724:14)
[Node]     at Module.require (internal/modules/cjs/loader.js:849:19)
[Node]     at require (internal/modules/cjs/helpers.js:74:18)

@lopesboa
Copy link

I don't know if is to late to help, can you check your tsconfig file if you set the right specification on target & module.

"target":  "ES VERSION THAT YOU ARE CURRENT USING"  /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */

"module":  "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants