types: Restricts `preact.config.js`'s `env` types to a more idiomatic subset
What kind of change does this PR introduce?
refactor of preact.config.js types
Did you add tests for your changes?
N/A
Summary
Goes along with #1734
env in preact.config.js is quite overloaded and has numerous semi-duplicated values: production and isProd, ssr and isServer, etc. I'd like to cut this down to just isProd, isDev, and isServer in v4, but for now, a good start would be to restrict the types & update the wiki.
At best, the types/values beyond these three (and their duplicates) are just convenience (not having to get the path for src yourself), and at worst, confuse new users.
Does this PR introduce a breaking change?
No
🦋 Changeset detected
Latest commit: 3efc14d4f0878a6978d1f30485692f3169c8d19b
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| preact-cli | 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
Is isServer the one for prerendering? I regret calling it "SSR" here haha
Yes, isServer is the one for prerendering.
Regret it as in think it should change to something else? isPrerender?
Yeah, SSR is a bit of a misnomer there. Unless folks are still abusing it for SSR? haha
Some still are or at least want to, but I've been dissuading.
I'm somewhat partial to isServer as it doesn't really mean 'Server' as in 'SSR' (even if that's what it's used for) but the server Webpack config. We have webpack-server-config.js in the source and so it makes sense that you'd use isServer to peek inside/edit that config.
That might just be me doing mental gymnastics to justify what I'm familiar with though.