Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a nodeIntegration option for webpack renderer config #2293

Closed
3 tasks done
malept opened this issue May 26, 2021 · 0 comments · Fixed by #2330
Closed
3 tasks done

Provide a nodeIntegration option for webpack renderer config #2293

malept opened this issue May 26, 2021 · 0 comments · Fixed by #2330
Assignees
Labels
enhancement plugin/webpack Issues or pull requests related to first-party webpack plugins/templates

Comments

@malept
Copy link
Member

malept commented May 26, 2021

Preflight Checklist

  • 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 a feature request that matches the one I want to file, without success.

Problem Description

From #2289:

Target: web not working for renderer processes with nodeIntegration: true

While it's certainly debatable whether or not to have nodeIntegration active in the renderer processes, I can't fully swap Zettlr over to the new sandboxed models in an instance. The newly added target: ['web', 'electron-renderer'] throws errors because webpack won't leave require()s alone (this includes the index.js from the electron-package, which is being called whenever some node module is being required). The only way I have found to solve it is to overwrite the target of the renderer

Proposed Solution

Add a nodeIntegration option to WebpackPluginRendererConfig which sets the target appropriately:

  • When nodeIntegration is true, the target is electron-renderer.
  • When nodeIntegration is false, the target is web.

Defaults to false since Electron has defaulted nodeIntegration to false since Electron 5.

Alternatives Considered

Again, from #2289:

Manually set target: 'electron-renderer' for the renderer process

This puts the onus on the app developer to know about Webpack targets, and I'd prefer to avoid that.

Additional Information

This will probably also need documentation on the website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement plugin/webpack Issues or pull requests related to first-party webpack plugins/templates
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant