电子-为什么我可以在客户端使用require()

时间:2021-07-19 16:19:09

I am using the electron framework and I noticed that I can use require() on the client side without adding anything like require.js or head.js. Example front-end code:

我正在使用电子框架,我注意到我可以在客户端使用require(),而不添加任何像require这样的东西。js或head.js。前端代码示例:

$(document).ready(function() {
    const { remote, ipcRenderer } = require("electron")
    const path = require("path")
    const url = require("url")
})

Thanks in advance.

提前谢谢。

1 个解决方案

#1


2  

Electron binds Node and Chromium so that you can do that. Read up on that here: https://electronjs.org/docs/tutorial/application-architecture#using-nodejs-apis

电子结合节点和铬,这样你就可以做到。请阅读这里:https://electronjs.org/docs/tutorial/applicationarchitecture #using-nodejs-api

#1


2  

Electron binds Node and Chromium so that you can do that. Read up on that here: https://electronjs.org/docs/tutorial/application-architecture#using-nodejs-apis

电子结合节点和铬,这样你就可以做到。请阅读这里:https://electronjs.org/docs/tutorial/applicationarchitecture #using-nodejs-api