Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

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

Merged
dario-piotrowicz merged 3 commits intomainfrom
dario/keep-process-env-false
Dec 16, 2024
Merged

set keepProcessEnv to false and re-enable react module-resolution test#107
dario-piotrowicz merged 3 commits intomainfrom
dario/keep-process-env-false

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

@pkg-pr-new
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
@dario-piotrowicz dario-piotrowicz deleted the dario/keep-process-env-false branch December 16, 2024 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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