Skip to content
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

types: Restricts preact.config.js's env types to a more idiomatic subset #1735

Merged
merged 5 commits into from Nov 18, 2022

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Aug 13, 2022

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

@rschristian rschristian requested a review from a team as a code owner August 13, 2022 07:31
@changeset-bot
Copy link

changeset-bot bot commented Aug 13, 2022

🦋 Changeset detected

Latest commit: 3efc14d

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

@developit
Copy link
Member

Is isServer the one for prerendering? I regret calling it "SSR" here haha

@rschristian
Copy link
Member Author

Yes, isServer is the one for prerendering.

Regret it as in think it should change to something else? isPrerender?

@developit
Copy link
Member

Yeah, SSR is a bit of a misnomer there. Unless folks are still abusing it for SSR? haha

@rschristian
Copy link
Member Author

rschristian commented Aug 17, 2022

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.

@rschristian rschristian merged commit 099876b into master Nov 18, 2022
@rschristian rschristian deleted the types/restrict-config-env branch November 18, 2022 22:43
@preact-bot preact-bot mentioned this pull request Nov 18, 2022
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.

None yet

3 participants