-
Notifications
You must be signed in to change notification settings - Fork 68
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
fix: do not override preset
when prerendering
#605
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #605 +/- ##
======================================
Coverage ? 1.31%
======================================
Files ? 44
Lines ? 2894
Branches ? 44
======================================
Hits ? 38
Misses ? 2815
Partials ? 41 โ View full report in Codecov by Sentry. |
src/commands/build.ts
Outdated
const nitroPreset = ctx.args.prerender ? 'static' : ctx.args.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET | ||
const resolvedNitroPreset | ||
= ctx.args.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET | ||
const nitroPreset = ctx.args.prerender ? 'static' : resolvedNitroPreset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact this is still not quite right - there are several static presets, including vercel-static
, netlify-static
, and so on, and we probably need to ignore (that is, not log warnings) for any static preset that's passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like nitro tries to infer the correct static preset based on the value of preset
when static: true
(nitrojs/nitro#2860) it's undocumented though (nitrojs/nitro#1524). I just removed the logging and only fall back to static preset if none is provided during prerender, is this what you had in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not set the static preset but instead pass static: true
you can test by setting (for example) NETLIFY=1 nuxi build --prerender
- we want it in that case to use netlify-static preset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I think/hope I finally understand, I removed the overriding of the preset variable and now log the resolved nitro preset instead.
preset
when prerendering
๐ Linked issue
โ Type of change
๐ Description
Related to #555, possibly resolves it?
We currently override any configured preset with
static
, instead we should let nitro resolve the appropriate preset by passingstatic: true
since it supports several static presets.