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

Add esModuleInterop = true in tsconfig.json to enable bundle with Vite #79

Open
wand2016 opened this issue Sep 26, 2023 · 0 comments
Open

Comments

@wand2016
Copy link

wand2016 commented Sep 26, 2023

What would you like to be added:

in tsconfig.json:

{
  "compilerOptions": {
+   "esModuleInterop": true
  },
  ...
}

Why is this needed:

The cognito-at-edge package is designed to be deployed to Lambda@Edge.
Lambda@Edge does not support Lambda layers, and the function size limit is up to 1 MB.
Consequently, some form of bundlers is required to deploy cognito-at-edge.
(Running npm i cognito-at-edge resulted in a node_modules directory size of >1MB)

Unlike the sample repo, I adopted terraform for IaC and Vite as a bundler.
The build and deploy processes worked fine, but I encountered the following runtime error:

TypeError: (0 , $.default) is not a function
    at new D (/.../dist/node_modules/cognito-at-edge/dist/index.js:1:1995)
    at t (/.../dist/index.js:1:499)

Node.js v18.18.0

By forking this repository, setting esModuleInterop = true, and running npm run build, the error was resolved.

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

No branches or pull requests

1 participant