electron / electron/forge

Vite plugin: support `nodeIntegration: true` in the renderer process.

Open
#3,961 6 comments 0 reactions 0 assignees View on GitHub
enhancement plugin/vite
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

### Problem description

When using the electron forge vite plugin, configuring vite for `nodeIntegration: true` in the renderer process requires too much of vite-specific knowledge and configuration. Further, even if one makes it work, there is no guarantee that it won't break on future updates of the plugin since it such configuration could interfering with internal assumptions of the plugin.

### Proposed solution

Something like the webpack plugin does for this use case. See https://github.com/electron-forge/electron-forge-docs/blob/f83f6237a6e0018c426a1b7efddc8098eca2c01c/config/plugins/webpack.md?plain=1#L269 .

### Alternatives considered

- fragile "Manual" vite configuration as described above.
- shifting a lot of what would be in the renderer into the preload script (incurs more boilerplate and complexity).

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.