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
[Bug]: ESM not supported with Netlify functions? #750
Comments
|
I'm running into the same issue. It seems to happen if the next.js page bundle loads a node module which has I tried fixing it by setting the I also tried to use the old plugin version |
|
Thanks @fschucht for your comment and the detailed error |
|
Same here: {
"errorType": "Runtime.UnhandledPromiseRejection",
"errorMessage": "ReferenceError: exports is not defined",
"trace": [
"Runtime.UnhandledPromiseRejection: ReferenceError: exports is not defined",
" at process.<anonymous> (/var/runtime/index.js:35:15)",
" at process.emit (events.js:326:22)",
" at processPromiseRejections (internal/process/promises.js:209:33)",
" at processTicksAndRejections (internal/process/task_queues.js:98:32)"
]
}
[build]
publish = ".next"
[[plugins]]
package = "@netlify/plugin-nextjs" |
|
This should now be fixed in the build system. For local builds you'll need to upgrade netlify-cli, but in CI you should be abel to trigger a new build and it should work. |
|
Thanks a lot @ascorbic! I confirm everything is now working on my side 💯 |
Steps to reproduce
Hello!
I've an error in the Netlify function
___netlify-handlercomplaining aboutexportsnot being defined for a node module.Looks like Netlify functions are using a Node.js version that don't supports ESM, am I right?
Starting with Next.js 12, ESM are supported out of the box, am I missing something?
Thank you!
A link to a reproduction repository
algolia/pwa-ecom-ui-template#33
More information about your build
What OS are you using?
Mac OS
Your
netlify.tomlfileRelevant log output (or link to your logs)
The text was updated successfully, but these errors were encountered: