-
Notifications
You must be signed in to change notification settings - Fork 169
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
Allow multiple preload configs or renderer configs #154
Comments
|
Ah thanks, sorry for the noise! |
I’m getting around to trying this; unfortunately, providing multiple
Since Rollup fundamentally lacks support for disabling chunks and duplicating shared dependencies into every output, we need a way for electron-vite to create multiple independent Rollup configs for preloads. |
@andersk When different preloads import some shared methods or modules and the output format is CommonJS, chunks will definitely be generated. UMD format can be output to a single file but not apply to preload scripts. It is best to refactor the shared modules and import them separately. |
Like I said, I understand that the Electron sandbox doesn’t support chunks, and that a single Rollup configuration with multiple inputs doesn’t support avoiding chunks. That is why my request is for electron-vite to use multiple Rollup configurations, each with a single input. That way there is nothing to share and extra chunks will not be generated. (Just like the way it already avoids generating chunks for code shared between the main and renderer processes, for example.)
|
@andersk |
Is there any better suggestion? |
It would be better if Electron, Rollup, and Vite had better support for this, but they don’t, so the only option I see is for electron-vite to allow the creation of multiple Vite configurations. My specific proposal is to allow the user to provide // electron.vite.config.js
export default {
…
preload: [
{
// first preload config
},
{
// second preload config
},
{
// third preload config
},
],
…
} |
i think is unnecessary. you can define a adapter function to solve this. |
@Mesimpler Your comment doesn’t make sense. The discussion is about chunking in the output of electron-vite, not chunking the config file itself. |
Being able to provide multiple main configs would also solve the issue that led to me creating this PR #412 |
Plan to support this feature |
@andersk I also encountered this problem and came across this post today by chance. It appears I'm not the only one facing this issue, so I tried writing a plugin to temporarily solve the problem. This is just for reference.
|
Clear and concise description of the problem
I’m working on an app that uses multiple preload scripts (one for the main window and one for embedded webviews). This works with vite-plugin-electron. I’m interested in trying electron-vite for better performance, but it seems electron-vite only supports one preload configuration.
Suggested solution
Allow
preload
andrenderer
to be arrays of Vite configs.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: