-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Setting mode: "production"
in programmatic build()
doesn’t set NODE_ENV
#9574
Comments
Thanks for your report 🙌 From a quick test, it looks like Pagefind is running at the end of the build as expected although the search feature is definitely not accessible. This is due to this check and this one relying on import { build } from 'astro';
await build({
root: './',
// Setting `mode` will not change the value of `import.meta.env.DEV`
}); We could easily switch to
|
@HiDeoo yea I found the Search.astro component and was mostly looking for clarification if this is intended behavior or not. But it is interested it seems to set the ENV properly with |
Thanks for the issue @KonnorRogers! I think this is a bug in the JS API not setting the same environment as its CLI equivalent. Let me check with the |
mode: "production"
does not enable pagefind searchmode: "production"
in programmatic build()
doesn’t set NODE_ENV
Chatted with @bluwy and confirmed we can fix this upstream in the main Astro repo. Thanks again for reporting @KonnorRogers! |
❤️ thank you all! Astro rocks 🤘 |
What version of
starlight
are you using?0.15.0
What version of
astro
are you using?4.0.6
What package manager are you using?
npm
What operating system are you using?
mac
What browser are you using?
Firefox
Describe the Bug
When using programmatic JS APIs, setting
mode: "production"
, still requires setting:process.env.NODE_ENV = "production"
to enable pagefind.Example:
I'm not sure if this is expected behavior, or if its a bug.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-a6bay1?file=README.md
Participation
The text was updated successfully, but these errors were encountered: