Reputation: 4925
I have folder structure like this:
- hardhat.config.ts
- src
---- scripts
---- contracts
---- ...
...
However when I do: npx hardhat node
I get the error: SyntaxError: Cannot use import statement outside a module
.
Here's my tsconfig file:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@@/*": ["./src/*"],
"@@/components/*": ["./src/app/components/*"]
},
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Note that I purposely made @/
to @@/
thinking if this maybe messing things up but that didn't seem to solve the issue either.
Upvotes: 1
Views: 97