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

Bundle 3rd part modules in the preload script to allow use when sandboxing is enabled #880

Closed
glocore opened this issue Dec 10, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@glocore
Copy link

glocore commented Dec 10, 2022

Is your feature request related to a problem? Please describe.
When sandboxing is enabled, we can't require() an external module in the preload script. The current config bundles up all local files so that we can split our preload source code into multiple files (nice 👍). But it would be awesome if we could also use 3rd party modules such as electron-better-ipc inside our preload script while in sandbox mode.

Describe the solution you'd like
Bundle 3rd party dependencies in the preload script output, similar to how we're bundling our local source code.

Describe alternatives you've considered
Disabling sandboxing is the only solution for now.

@glocore glocore added the enhancement New feature or request label Dec 10, 2022
@cawa-93
Copy link
Owner

cawa-93 commented Dec 10, 2022

Previously it works exacly as you described. But this led to numerous problems (#664, #655, #613), because there are a huge number of packages that he will not be able to fully bundle. Usually these are packages that depend on native APIs directly or transitively.

If it not problem for your case, set ssr.noExternal: true. It

  • Treat all dependencies as noExternal
  • Throw an error if any Node.js built-ins are imported

Related: https://vitejs.dev/guide/ssr.html

@cawa-93 cawa-93 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2022
@glocore
Copy link
Author

glocore commented Dec 10, 2022

Makes sense, thanks for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants