examples icon indicating copy to clipboard operation
examples copied to clipboard

Cannot use import statement outside a module

Open elie222 opened this issue 3 years ago • 3 comments

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

elie222 avatar Jun 16 '22 16:06 elie222

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.

dominiksipowicz avatar Jun 17 '22 08:06 dominiksipowicz

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

leerob avatar Jun 17 '22 14:06 leerob

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

aduarterengifo avatar Jun 28 '22 14:06 aduarterengifo

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

veryserious avatar Aug 18 '22 06:08 veryserious

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.

mkayander avatar Sep 10 '22 18:09 mkayander