-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
ReactRefresh - Addition of Hot Reloading creates preload.js error #3115
Comments
I had this issue as well, looks like the plugin is bundling the preload script with the same webpack configuration used by the main script by default (#2679), so Since I'm not using the preload script (yet), adding an empty object as the preload webpack configuration worked for me: new WebpackPlugin({
devServer: { liveReload: false },
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
html: './src/index.html',
js: './src/renderer.ts',
name: 'main_window',
preload: {
js: './src/preload.ts',
config: {} // => add this
},
},
],
},
}), Maybe the main, renderer, and preload files should be moved to separate folders inside |
I'm using preload script to load react. Any way to workaround this issue when using preload script? 😒 |
@Rychu-Pawel try this: preload: {
js: './src/preload.ts',
config: {
...rendererConfig,
plugins: [],
},
} |
@erikian this works like a charm!! Thank you so much 🍻 my life is going to get so much easier now 🌅🌴 🍸 |
Pre-flight checklist
Electron Forge version
6.0.3
Electron version
21.3.1
Operating system
macOS 12.4
Last known working Electron Forge version
No response
Expected behavior
Expected not to have issues after adding React Refresh and to not have the entire window refresh every time. I expected to only have the one component refreshed and not the whole window.
I am trying to understand how to run React Refresh within Electron Forge properly, I searched the existing issues and this is where I got my forge.config.ts file updates from aka setting liveReload to false but I seem to still be getting some errors.
I'd appreciate some guidance to get it to work appropriately. Also before adding React Refresh I did not get the
__dirname is not defined
error or theUnable to load preload script
error.Actual behavior
When I do
yarn run start
I get the below errors in the console:Steps to reproduce
package.json
forge.config.ts
wepbpack.plugin.ts
Additional information
No response
The text was updated successfully, but these errors were encountered: