electron-react-boilerplate
electron-react-boilerplate copied to clipboard
Create multiple Windows
How to do create multiple Windows
At a minimum, you'll need a second call to new BrowserWindow({...})
in your main process. You might also want different html template entry points.
If you want to load a different html template for the second window, you'll need another new HtmlWebpackPlugin({...})
entry in the various webpack configs.
HtmlWebpackPlugin
我配置了但是加载的是同一个html文件
I configured but the same html file is loaded
Did you see the .loadURL(...)
line in the example?
kanl
看了的
渲染的时候还是调用的renderjs来进行渲染的
我用路由的形式去,在开发环境下可以但是在生产环境下就不行了
HtmlWebpackPlugin
automatically inserts a script tag for the Webpack "entry
". You're getting into some slightly more advanced usage of HtmlWebpackPlugin
.
I think you'll need to add a second entry
for webpack and then configure the different HtmlWebpackPlugin
instances to use one or the other. I think that's what the chunks
array is for.
这个entry 我配置了第二个 但是输出的文件都只有这一个呀 我在webpack.config.render.dev.ts 中配置了 也在 webpack.config.render.prod.ts中也配置了 但是输出的文件都只有render.js
生产环境是file协议,可能要用hash路由或者用query来区分渲染不同的页面
我用路由的形式去,在开发环境下可以但是在生产环境下就不行了
Anyone stuck here pls contact me
I wrote a guide based on this issue https://medium.com/@alielmajdaoui/multiple-windows-in-electron-react-boilerplate-c6d763f38306
@alielmajdaoui Nice, even I wrote a blog. https://dvgy.hashnode.dev/how-to-make-multi-window-electron-application
@alielmajdaoui Nice, even I wrote a blog. https://dvgy.hashnode.dev/how-to-make-multi-window-electron-application
thank you for tutorial but its not working when i build production, can u fix it pls ?
@emptydn1 you will need to edit the webpack prod file. I will try to document that in the same article I wrote if I got time this week.
I will try to document that in the same articl
@emptydn1 you need to copy paste the same config in webpack prod files
Closing because this seems resolved
@alielmajdaoui how about prod file, do u have time to write it?
@EricProcessor it's already updated