Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM4 sandbox_bundle:2 Error: module not found: node:module #244

Open
lancemach opened this issue Jun 6, 2024 · 1 comment
Open

VM4 sandbox_bundle:2 Error: module not found: node:module #244

lancemach opened this issue Jun 6, 2024 · 1 comment

Comments

@lancemach
Copy link

我在preload/index.ts文件中引入了 iconv-lite或者 secure-electron-license-keys类库
发现都报错

VM4 sandbox_bundle:2 Unable to load preload script: F:\electron\dist-electron\preload\index.mjs
VM4 sandbox_bundle:2 Error: module not found: node:module
    at preloadRequire (VM4 sandbox_bundle:2:82852)
    at <anonymous>:3:21
    at runPreloadScript (VM4 sandbox_bundle:2:83516)
    at VM4 sandbox_bundle:2:83813
    at VM4 sandbox_bundle:2:83968
    at ___electron_webpack_init__ (VM4 sandbox_bundle:2:83972)
    at VM4 sandbox_bundle:2:84095

我尝试使用了require或者import导入包都是不行这是我哪块配置不对还是兼容性问题导致的呢

@yejimeiming
Copy link
Contributor

需要在主进程中开启 webPreferences: { nodeIntegration: true }
你多看下 Electron 官方文档,或者在主进程中使用一些 Node.js 的库试试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants