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

nodeIntegration breaks monaco-editor in React #20

Open
johnlindquist opened this issue Jan 5, 2023 · 3 comments
Open

nodeIntegration breaks monaco-editor in React #20

johnlindquist opened this issue Jan 5, 2023 · 3 comments

Comments

@johnlindquist
Copy link

In my app, if I enable:

renderer({
      nodeIntegration: true
    }),

Then after bundling, the monaco-editor causes the React app to completely re-mount and lose all its state.
My best guess is that monaco-editor uses a Worker that detects Electron and fails. It has been almost impossible to debug.

Note: This works fine in npm run dev mode, it only breaks after npm run build then dynamically loading the monaco-editor

Any ideas?

@caoxiemeihao
Copy link
Member

image

kitapp gives some errors when I run it locally, is it possible to provide a simple replication of the Demo, I will focus more on the problems vite-plugin-electron-renderer is facing.

@johnlindquist
Copy link
Author

@caoxiemeihao Sorry, I missed this. I'll try to get around to this tomorrow.

I don't need to use the nodeIntegration property, so I stopped investigating for now and switched to working on other things.

Why is nodeIntegration the default? I feel like I'm missing why I would want to use it.

@caoxiemeihao
Copy link
Member

caoxiemeihao commented Jan 16, 2023

Vite does not provide a corresponding Electron pre-config. So nodeIntegration is designed to ensure that Vite builds the Electron-Renderer correctly. It is disabled by default.

  /**
   * @default false
   */
  nodeIntegration?: boolean

https://github.com/electron-vite/vite-plugin-electron-renderer/blob/v0.11.0/src/index.ts#L8-L11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants