-
Notifications
You must be signed in to change notification settings - Fork 137
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
[bug] bytecodePlugin 不在参数chunkAlias里的chunk依然被注入了require("./bytecode-loader.js"),导致报错 #49
Comments
@joyexpr 预加载脚本需要禁用 sandbox 才能支持字节码,因为字节码是基于 Node 的 vm 模块实现。从 Electron 20 开始,渲染器默认会被沙箱化,所以如果你想使用字节码来保护预加载脚本,你需要设置 sandbox: false。 |
@joyexpr 邀请你进群 |
webview 中的webpreferences 可以设置,你提到的如果不加固任然会导入,可能有问题,我再看看 |
试了下设置 就可以支持preload加固了 不过发现webpreferences中设置 contextIsolation=no 是无效的, preload 中 process.contextIsolated 还是为 true,必须 webview 所在页面的 browserWindow 中设置 contextIsolation: false 才有效,不知道您了解吗是不是这样 |
是的 |
发现由于设置了 contextIsolation: false,如果开启加固,则会报 process not defined,必须开启 browserWindow的 nodeIntegration = true 才行,不大想开启nodeIntegration,只能取消加固了,所以只能等你修复注入require("./bytecode-loader.js") 的bug了。。。。 |
new ver 1.0.13 is out! You can learn more by playing with the example and run |
Describe the bug
bytecodePlugin 不在参数chunkAlias里的chunk依然被注入了require("./bytecode-loader.js"),导致报错
我对preload代码也进行了bytenode 加固,发现对于 webview标签 的preload脚本 貌似不支持进行加固,
所以将webview的preload脚本设置为不在加固chunkAlias中,但发现虽然没生成jsc,但js中依然被注入了require("./bytecode-loader.js"),导致webview找不到该js,当然即使能加载到 bytecode-loader.js,也会提示不支持 fs 等模块
Electron-Vite Version
1.0.9
Electron Version
21.2.0
Vite Version
3.2.1
Validations
The text was updated successfully, but these errors were encountered: