-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
To enable the sandbox in browser webview of desktop app, we need to change the webpack config for preload.js in:/packages/injected/webpack.config.cjs as follow:
const nativeConfig = merge(commonConfig, {
target: 'electron-preload',
entry: {
injectedDesktop: './src/injectedDesktop.ts',
},
});
to the new one:
const nativeConfig = merge(commonConfig, {
target: 'web',
entry: {
injectedDesktop: './src/injectedDesktop.ts',
},
externals: {
electron: 'commonjs electron', // 将 Electron 标记为外部模块
},
});
Otherwise, there will be a issue caused by import electron
in preload.js, because of the limitation of sandbox such as limitation in require
.
PR related to this is here:Change preload.js webpack config to support sandbox
PR related to app's sandbox config is here:Enable sandbox in browser's webview of desktop
Metadata
Metadata
Assignees
Labels
No labels