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-webpack): preload race condition #3353

Merged
merged 5 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename var
  • Loading branch information
georgexu99 committed Sep 19, 2023
commit 9288cc90d872c0d64d6ec1f100e72e8ebcb6a129
4 changes: 2 additions & 2 deletions packages/plugin/webpack/src/WebpackPlugin.ts
Original file line number Diff line number Diff line change
@@ -290,7 +290,7 @@ the generated files). Instead, it is ${JSON.stringify(pj.main)}`);
}

const preloadPlugins: string[] = [];
let preloadEntriesWithConfig = 0;
let numPreloadEntriesWithConfig = 0;
for (const entryConfig of configs) {
if (!entryConfig.plugins) entryConfig.plugins = [];
entryConfig.plugins.push(new ElectronForgeLoggingPlugin(logger.createTab(`Renderer Target Bundle (${entryConfig.target})`)));
@@ -299,7 +299,7 @@ the generated files). Instead, it is ${JSON.stringify(pj.main)}`);
if (filename?.endsWith('preload.js')) {
let name = `entry-point-preload-${entryConfig.target}`;
if (preloadPlugins.includes(name)) {
name = `${name}-${++preloadEntriesWithConfig}`;
name = `${name}-${++numPreloadEntriesWithConfig}`;
}
entryConfig.plugins.push(new EntryPointPreloadPlugin({ name }));
preloadPlugins.push(name);