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

Default resolve condition "node" for preload causes incompatible node versions of modules to be loaded when nodeIntegration is disabled #204

Closed
4 tasks done
shayded-exe opened this issue Jul 4, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@shayded-exe
Copy link

Describe the bug

Preload should not have "node" set as a resolve condition by default, as there's no way to disable it because vite's mergeConfig will merge arrays.

My preload uses the uuid module. Because of this condition, it bundles the node version module instead of the browser version, which breaks because it requires the crypto module and I have node integration disabled.

Electron-Vite Version

1.0.24

Electron Version

22

Vite Version

4.1.1

Validations

@shayded-exe shayded-exe added the bug Something isn't working label Jul 4, 2023
@alex8088
Copy link
Owner

alex8088 commented Jul 4, 2023

@shayded-exe I'm also thinking about this. You can externalize it first(sandbox needs to be disabled).

@shayded-exe
Copy link
Author

shayded-exe commented Jul 4, 2023

Disabling sandbox isn't an option for me.

@alex8088
Copy link
Owner

alex8088 commented Jul 4, 2023

The next version will remove this condition for preload.

@alex8088
Copy link
Owner

alex8088 commented Jul 4, 2023

@shayded-exe You can set resolve.condition to [].

@shayded-exe
Copy link
Author

@alex8088 That doesn't overwrite the value though. Vite's mergeConfig concats the arrays.

See here:
https://github.com/vitejs/vite/blob/main/packages/vite/src/node/utils.ts#L1038

@alex8088
Copy link
Owner

new ver 1.0.25 is out!

@shayded-exe
Copy link
Author

Thank you! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants