electron-vite-react icon indicating copy to clipboard operation
electron-vite-react copied to clipboard

Security: Is there a better solution to import serialport without setting " nodeIntegration: true; contextIsolation: false"

Open gaspardruan opened this issue 1 year ago • 0 comments

I set the renderer plugin as document suggests, everything is fine with importing serialport when:

renderer({
      resolve: {
        serialport: { type: "cjs" },
      },
 })
win = new BrowserWindow({
    webPreferences: {
      contextIsolation: false,
      nodeIntegration: true,
    },
  });

But electron document said that this is not suggested for security.

So, I delete the two settings, then problem occured: image

I wonder if there is a better solution to import serailport without the above settings.

gaspardruan avatar Feb 22 '24 11:02 gaspardruan