Electron允许渲染器中的'require(';path';)',即使'nodeIntegration'设置为'false'`

Electron允许渲染器中的'require(';path';)',即使'nodeIntegration'设置为'false'`,electron,Electron,我的理解是,将nodeIntegration设置为false将阻止对渲染器进程中节点模块的访问。但是我能够执行require('path'),尽管nodeIntegration设置为false 我的理解不对吗 如果我的理解是正确的,但是path给出了一个异常,我想知道是否有其他模块给出了相同的异常 这是我的浏览器窗口选项 mainWindow = new BrowserWindow({ webPreferences: { // The below configuratio

我的理解是,将
nodeIntegration
设置为
false
将阻止对渲染器进程中节点模块的访问。但是我能够执行
require('path')
,尽管
nodeIntegration
设置为
false

我的理解不对吗

如果我的理解是正确的,但是
path
给出了一个异常,我想知道是否有其他模块给出了相同的异常

这是我的
浏览器窗口
选项

  mainWindow = new BrowserWindow({
    webPreferences: {
      // The below configurations are set to achieve the maximum
      // security possible in Electron
      contextIsolation: true,
      webSecurity: true,
      enableRemoteModule: false,
      nodeIntegration: false,
      nodeIntegrationInSubFrames: false,
      nodeIntegrationInWorker: false,
      allowRunningInsecureContent: false,
      sandbox: true,

      preload: join(__dirname, "preload.js"),
    },

    center: true,
    title: "Orange",
    minWidth: 800,
    minHeight: 600,
  });

您还可以发布您的
浏览器窗口
选项吗?为了检查您是否在
webPreferences
@Joshua中设置了
nodeIntegration
,我已经更新了帖子,添加了
BrowserWindow
选项谢谢Safi,一切看起来都很好。你是说你仍然可以在你的预加载脚本中,还是在你的页面中
require('path')
。@Joshua我可以在
index.html
中引用的
app.js
文件中从“path”导入路径(顺便说一句,我正在用webpack构建)