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

set keepProcessEnv to false and re-enable react module-resolution test #107

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

dario-piotrowicz
Copy link
Contributor

@dario-piotrowicz dario-piotrowicz commented Dec 10, 2024

resolves #82


As discussed in #94

As per our docs:
Screenshot 2024-12-10 at 17 01 00

in workers process.env is an empty object, so I think it's actually ok to just use keepProcessEnv: false since Vite replaces process.envs with empty objects, so I think that there is actually little to no difference between having keepProcessEnv set to true or false for us

Setting if to false has the benefit that Vite replaces process.env.NODE_ENV when keepProcessEnv is false (discord message) fixing the issue we were encountering with the react import

keepProcessEnv: true could be needed if the workerd process.env implementation were to change at some point, but right now keepProcessEnv: false might be the most appropriate configuration

Copy link

pkg-pr-new bot commented Dec 10, 2024

Open in Stackblitz

npm i https://pkg.pr.new/flarelabs-net/vite-plugin-cloudflare/@flarelabs-net/vite-plugin-cloudflare@107

commit: 6e7c241

Copy link
Contributor

@jamesopstad jamesopstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Do you mind adding some context to the description based on what we discussed in the other PR (and the Cloudflare docs)? Then @petebacondarwin can review and understand the implications. Thanks.

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't fail tests and seems to work. Then this seems like a reasonable change to make.

@dario-piotrowicz dario-piotrowicz changed the title set keepProcessEnv to false and re-enable react module-resolution test remove keepProcessEnv: true option and re-enable react module-resolution test Dec 16, 2024
@dario-piotrowicz dario-piotrowicz changed the title remove keepProcessEnv: true option and re-enable react module-resolution test set keepProcessEnv to false and re-enable react module-resolution test Dec 16, 2024
@dario-piotrowicz dario-piotrowicz merged commit f605226 into main Dec 16, 2024
5 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/keep-process-env-false branch December 16, 2024 15:59
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.

In the module resolution playground app the react import works during dev but not build
3 participants