太仓企业网站建设价格,新乡网站建设方案,制作网页app,wordpress作品集主题 免费在main.js 中使用require 报错 ‘require’ is not defined
事先声明 #xff0c;可能是版本不一样#xff0c;所以解决办法不一样#xff0c;报错的原因是Pack.json 文件中type值不同#xff0c;解决办法有两种。 目前有什么弊端#xff0c;因为时间比较紧#xff0c;还…在main.js 中使用require 报错 ‘require’ is not defined
事先声明 可能是版本不一样所以解决办法不一样报错的原因是Pack.json 文件中type值不同解决办法有两种。 目前有什么弊端因为时间比较紧还没有详细查询欢迎大神指教 方法一type 为moudle 时 使用import 引入 pack.json 文件
type: modulemain.js
import {app,BrowserWindow} from electron方法二type 为commonjs时 使用require 引入 pack.json 文件
type: commonjsmain.js
const {app,BrowserWindow} require(electron)