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

fix(plugin-vite): stop the world #3736

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smallsung
Copy link
Contributor

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • The changes are appropriately documented (if applicable).
  • The changes have sufficient test coverage (if applicable).
  • The testsuite passes successfully on my local machine (if applicable).

Summarize your changes:
Run yarn run start. Under the default configuration, vite.build will call rollup.watch. If the first build fails, Promise.all will never be resolved.

build = async (): Promise<void> => {
const configs = await this.configGenerator.getBuildConfig();
const buildTasks: Promise<void>[] = [];
const isWatcher = (x: any): x is RollupWatcher => typeof x?.close === 'function';
for (const userConfig of configs) {
const buildTask = new Promise<void>((resolve, reject) => {
vite
.build({
// Avoid recursive builds caused by users configuring @electron-forge/plugin-vite in Vite config file.
configFile: false,
...userConfig,
plugins: [onBuildDone(resolve), ...(userConfig.plugins ?? [])],
})
.then((result) => {
if (isWatcher(result)) {
this.watchers.push(result);
}
return result;
})
.catch(reject);
});
buildTasks.push(buildTask);
}
await Promise.all(buildTasks);
};

@smallsung smallsung requested a review from a team as a code owner October 10, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant