共计 381 个字符,预计需要花费 1 分钟才能阅读完成。
问题描述
在 electron 桌面应用项目开发中,将 CommonJS 改为使用 ES 模块 (ESM) 语法后,preload.js 加载时报错(无法加载),并且浏览器控制台报错:Unable to load preload script:“x”| Error: require() of ES Module“x”not support. Instead change the require of preload.js in null to a dynamic import() which is available in all CommonJS modules.
这个问题很少,其他教程都无法解决,本文完美搞定此问题(全版本通用解决)!
解决方案
对于这个问题,
原文地址: vue – electron 报错 Unable to load preload script:“x“| Error: require() of ES Module“x“not support
正文完