Improve custom config support #416
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ofopen-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 ofopen-next.config.mjs
It also fix an issue where custom lazy loaded override where not used for functions other than the default one