electron-userland / electron-userland/electron-webpack-quick-start
Difficulty making a fetch request in the renderer process to third party API
- Dominant language
- JavaScript
- Stars
- 746
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Description
I was previously using electron-react-boilerplate and have [raised an issue there](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/2142) about this topic.
I migrated my project and everything is working fine apart from when I make a fetch request to Google, the **URL request is handled by a third-party npm package intended for node only due to CORS in the browser**. My code worked fine regardless though with their project despite calling from the renderer process.
I had tried disabling the web security when creating the `BrowserWindow()` in main process, but while it avoided the CORS issue, my request was still unsucessful. I only noticed the request headers having two additional fields, `referer` which pointed to the localhost dev server, and `cookies`.
Is there advice on how to get my Electron app to behave more like the linked boiler plate project is doing? I wasn't able to see what they're doing differently(they have special configuration for the webpack dev server, but nothing for production webpack config). In both cases their `index.html` is loaded via `file://filepath` rather than `http://localhost:port`, is it likely to be due to this?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.