webpack: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY is not defined
See original GitHub issue- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Please describe your issue:
I’m using the repo provided by @tgds found here. While it is in typescript rather than JS, it works no problem using the MAIN_WINDOW_WEBPACK_ENTRY
variable.
The documentation for the webpack plugin says
For an entry point with the name main_window two variables will be defined MAIN_WINDOW_WEBPACK_ENTRY and MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY
with this example:
const mainWindow = new BrowserWindow({
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
}
});
mainWindow.loadUrl(MAIN_WINDOW_WEBPACK_ENTRY);
However, if I modify the code in the repo provided to match, I get an error:
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
MAIN_WINDOW_PRELOAD_WE...
@G-Rath MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY will only be defined if a preload is defined in your @electron-forge/plugin-webpack config. Their is ...
Read more >WebPack-Dev-Server error: require is not defined
I hit this issue when a webpack.config.js from a node app for the base of a react app ...
Read more >Webpack Plugin - Electron Forge
This plugin makes it easy to set up standard webpack tooling to compile both your main process code and your renderer process code,...
Read more >Entry and Context - webpack
The entry object is where webpack looks to start building the bundle. The context is an absolute string to the directory that contains...
Read more >Configuration Languages - webpack
Webpack accepts configuration files written in multiple programming and data languages. The list of supported file extensions can be found in the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What worked for me was:
I found it by looking at the repository related to another reported bug. It would be truly appreciated if you could update the documentation a little bit - I was searching for hours to find a way how tu use typescript in the preload script.
It only says that I should use the variable
MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY
but says nothing where it comes from and what should I do to initialize it.Also it’d be very helpful to explain the magic behind the naming.