Skip to content

Improve custom config support #416

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

Merged
merged 4 commits into from
May 24, 2024
Merged

Conversation

conico974
Copy link
Contributor

Before this PR, OpenNext used a single compiled open-next.config.mjs file even for the edge runtime. It achieved this by setting the platform as neutral in esbuild which caused a lot of trouble when using custom overrides.

With this PR OpenNext will create 2 different bundle for open-next.config.mjs, one for node and one for edge, and copy the correct one depending on the function runtime.
To properly support this, there is a new build args --node-externals that is used for esbuild during compilation of open-next.config.ts ( for example --node-externals "@aws-sdk/*,sharp" to remove every aws sdk and sharp deps from the config file ).
There is also a new options in open-next.config.ts : edgeExternals that serve the same purpose but for the edge version of open-next.config.mjs

It also fix an issue where custom lazy loaded override where not used for functions other than the default one

Copy link

changeset-bot bot commented May 17, 2024

🦋 Changeset detected

Latest commit: 9b483d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
open-next Patch
app-pages-router Patch
app-router Patch
tests-unit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
open-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 24, 2024 11:33am

@conico974 conico974 merged commit e98e014 into opennextjs:main May 24, 2024
2 of 3 checks passed
@conico974 conico974 deleted the fix/custom-config branch October 29, 2024 10:40
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

Successfully merging this pull request may close these issues.

1 participant