Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use import statement outside a module #302

Closed
elie222 opened this issue Jun 16, 2022 · 5 comments · Fixed by #394
Closed

Cannot use import statement outside a module #302

elie222 opened this issue Jun 16, 2022 · 5 comments · Fixed by #394

Comments

@elie222
Copy link

elie222 commented Jun 16, 2022

When running the cdk example the following error occurs when running cdk bootstrap:

import 'source-map-support/register';
^^^^^^

SyntaxError: Cannot use import statement outside a module
@dominiksipowicz
Copy link
Member

hey @elie222 can you provide more information about your setup:

  1. output of npx next info
  2. did you used npm or yarn?

Maybe @GuiBibeau @leerob can help here because this is the AWS S3 image example, right?

This PR #296 was also merged after your issue was created.

@leerob
Copy link
Member

leerob commented Jun 17, 2022

It could be related to the version of Node.js you're using (guess).

@aduarterengifo
Copy link

I also ran into a similar issue use, tried both npm and yarn.
Operating System: Platform: darwin Arch: x64 Node: 18.4.0 npm: 8.12.1 Yarn: 1.22.11 pnpm: N/A Relevant packages: next: 12.1.6 react: 18.2.0 react-dom: 18.2.0

@veryserious
Copy link

veryserious commented Aug 18, 2022

Same issue with output of npx next info

Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 21.6.0: Binaries: Node: 16.16.0 npm: 8.11.0 Yarn: 1.22.19 pnpm: N/A Relevant packages: next: 12.2.4 eslint-config-next: 12.2.4 react: 18.2.0 react-dom: 18.2.0

@mkayander
Copy link
Contributor

Hey everyone. The issue is that AWS CDK typescript code requires a bit different tsconfig settings. You can find the details in the linked PR i just pushed.

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

Successfully merging a pull request may close this issue.

6 participants