-
Notifications
You must be signed in to change notification settings - Fork 2
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
use the new resolve.builtins
vite config to specify the cloudflare and node builtins
#52
base: main
Are you sure you want to change the base?
Conversation
c0ac005
to
cd6d5fa
Compare
400c034
to
0a95cfa
Compare
6b077cc
to
debe5e0
Compare
0a95cfa
to
c627bad
Compare
@@ -6,7 +6,7 @@ packages: | |||
catalog: | |||
'@cloudflare/workers-types': ^4.20241112.0 | |||
'typescript': ^5.6.2 | |||
'vite': '6.0.0-beta.10' | |||
'vite': '/Users/dario/Repos/my-repos/vite/packages/vite' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly this PR won't be ready to merge until the version of vite with the resolve.builtins config is (hopefully) released
resolve.builtins
vite config to specify the cloudflare and node builtins
c627bad
to
add5aa8
Compare
@@ -155,17 +155,12 @@ export function createCloudflareEnvironmentOptions( | |||
input: userConfig.root | |||
? path.resolve(userConfig.root, options.main) | |||
: path.resolve(options.main), | |||
external: [...cloudflareBuiltInModules, ...getNodeCompatExternals()], | |||
external: [...getNodeCompatExternals()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petebacondarwin we set these node externals unconditionally even if the worker is not under nodejs_compat, is that ok?
Or should we do it conditionally? (similarly to the addNodeBuiltinsIfNeeded
function that I'm adding here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do it conditionally if you like. I was being a bit lazy perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do it as part of this PR since I'm already adding the other function, so adding this logic should be quite simple 🙂
I just wanted to double check with you first because maybe them being always external for builds was intentional for some reason and/or it doesn't have real/significative downsides
anyways I can do this conditionally here, thanks 🙂
666015b
to
8ad4122
Compare
…and node builtins and remove the ad-hoc `cloudflare:` handling logic
8ad4122
to
147342e
Compare
resolves #46
paired with this PR I created in the Vite repo: vitejs/vite#18584
Note
The changes in vitejs/vite#18584 are most likely going to make it into vite around Jannuary (discord message) so this PR will be blocked until then