-
Notifications
You must be signed in to change notification settings - Fork 5
replace process.env.NODE_ENV at build time and enable react module-resolution build test
#94
Conversation
commit: |
68da74a to
4ca788e
Compare
|
According to this comment, Vite replaces https://discord.com/channels/804011606160703521/1314204727621193788/1314404199747813446 I'm wondering if it would be better to only set |
Sorry I am not sure I follow Specifically thinking of the react use case, we want react to work both with and without |
|
Ah, I probably misunderstood. I thought this example worked if It makes more sense to me now why this is a Cloudflare specific issue rather than a more general Vite one. |
I don't actually know, I'm unable to see if this works with
Ah, sorry I see what you meant now, you thought that maybe it should? WDYT? @petebacondarwin? |
|
I think your approach is correct. Even if I sort of wonder if we should actually always be using Let's check with @petebacondarwin for approval. |
oh yeah! treeshaking slipped my mind for a sec! 😓 👍 |
…resolution build test
4ca788e to
9b298ee
Compare
|
@petebacondarwin @dario-piotrowicz Please can you explain what would happen in our case if we always had |
This is, as far as I can tell, the only place in which Object.assign(processEnv, {
'process.env': `{}`,
'global.process.env': `{}`,
'globalThis.process.env': `{}`,
'process.env.NODE_ENV': JSON.stringify(nodeEnv),
'global.process.env.NODE_ENV': JSON.stringify(nodeEnv),
'globalThis.process.env.NODE_ENV': JSON.stringify(nodeEnv),
})(source) As per the Vite docs: My understanding is that So I think that basically with |
(👆 if you want I can spin up a new project and double check/corroborate the above) |
|
I did just try setting This also meant I could enable the React module-resolution test and it passes without any changes. |
yeah I suspect that we don't have test coverage for this 👍 I'll have a quick look |
I had a quick look and I noticed that I actually misread the docs (sorry totally my bad) 😓 in workers
|
|
closing in favour of #107 (since the core of the PR changes I figured it would make sense to just open a new one, I hope you guys done mind 😅) |


resolves #82