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
Lambda@Edge Builder fails on ESM modules #2391
Comments
The error still persists in the 3.7.0 version. I've traced it down to the function The only purpose of config overwrite is to assign a Would it be possible to remove that intrusive blocker from the builder? |
Running into the same issue. A quick and dirty workaround:
Change the entry to .cjs extension and rename the next.config.js in your app's root folder to next.config.cjs
As ESM adoption increases, a proper fix would be great. For example instead of defining a config directory, specify a config file and derive the config directory from it (which seem to be used for other stuff). Or check for the existence of .js, .mjs and .cjs by default. I put together a PR, but as @shishkin pointed out: The function may be obsolete anyway. #2478 targets this, although not handling next.config.cjs |
I tried to handle next.config.mjs but it caused other problems
I tried to fix that issue but ran into a different issue, described in the PR #2478 |
Issue Summary
I've tried building Lambda@Edge using the latest Next.js v12.1.0 release with
"type": "module"
setting inpackage.json
, which got recent support. The builder fails with an error suggesting thatnext.config.js
is treated as ESM and needs to be renamed to.cjs
. Renaming it confusingly produces the same error.Actual behavior
Expected behavior
Lambda@edge builds without errors.
Steps to reproduce
@sls-next/lambda-at-edge
dependency"type": "module"
setting inpackage.json
yarn build
yarn exec exec build-lambda-at-edge .
Screenshots/Code/Configuration/Logs
See above.
Versions
Additional context
Checklist
latest
oralpha
@sls-next/serverless-component
release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.js
component and theserverless-next.js
plugin are deprecated and no longer maintained.The text was updated successfully, but these errors were encountered: