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

NextJS@12 and .mjs in node_modules #275

Open
qpre opened this issue Jan 26, 2022 · 2 comments
Open

NextJS@12 and .mjs in node_modules #275

qpre opened this issue Jan 26, 2022 · 2 comments
Labels
feature/next.js Missing feature from Next.js

Comments

@qpre
Copy link

qpre commented Jan 26, 2022

Hello,

I just ran a few tests on an app I have running on tf-next 0.11.2.

the app uses urql (which uses a lib called wonka)

when deploying using next@11 everything works fine but when I deploy with next@12 all I get from the NEXT_PAGE_LAMBDA_0 logs is ERROR Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/node_modules/wonka/dist/wonka.mjs' imported from /var/task/node_modules/@urql/core/dist/urql-core.mjs

When I explore the lambda's deployment package I can see that indeed wonka.mjs does not exist but a wonka.js exists.

I tried doing the same deploy to Vercel and it works fine, therefore I think something (maybe the node version ?) is not on par but I can't seem to find what and how to fix it.

any idea ?

@ofhouse
Copy link
Member

ofhouse commented Jan 26, 2022

Yeah, Next.js 12 has support for esm while our module currently hasn't.
Since Vercel also uses Lambda (And the same Node.js version under the hood as this module) the problem is probably located in the the layer we use between Next.js and Lambda, which currently doesn't support esm.

You could probably workaround this by adding the following setting to your next.config.js:

module.exports = {
  experimental: {
    esmExternals: false
  }
}

@ofhouse ofhouse added the feature/next.js Missing feature from Next.js label Jan 26, 2022
@qpre
Copy link
Author

qpre commented Jan 26, 2022

that solves it yes, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/next.js Missing feature from Next.js
Projects
None yet
Development

No branches or pull requests

2 participants