electron-userland / electron-userland/electron-webpack

app does not load if nodeIntegration is disabled

Open
#320 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
902
Forks
168
PR merge metrics
No merged PRs in 30d

Description

* **Version**: 2.3.4

* **Target**: Electron (but changed webpack target to `web` due to disabled `nodeIntegration` in renderer config)

```
module.exports = function(config) {
config.target = 'web';

return config
}
```

I disabled `nodeIntegration` for several architectural reasons in my main window but due to the hardcoded `require` calles in `generateIndexFile` [RendererTarget.ts#L203](https://github.com/electron-userland/electron-webpack/blob/master/packages/electron-webpack/src/targets/RendererTarget.ts#L203) and [RendererTarget.ts#L206](https://github.com/electron-userland/electron-webpack/blob/master/packages/electron-webpack/src/targets/RendererTarget.ts#L206) i'm getting `Uncaught ReferenceError: require is not defined` (thrown from index:5) as well as `Uncaught ReferenceError: module is not defined` (thrown from renderer.js:1) errors.

This might be a issue which is specific to my use case but be aware that electron 6 disables `nodeIntegration` by default.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.