Skip to content

Commit

Permalink
feat: sandboxを有効化
Browse files Browse the repository at this point in the history
  • Loading branch information
sabonerune committed Jun 24, 2024
1 parent a4d0fa9 commit 94924c5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
3 changes: 0 additions & 3 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ async function createWindow() {
backgroundColor,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: false,
contextIsolation: true,
sandbox: false, // TODO: 外しても問題ないか検証して外す
},
icon: path.join(__static, "icon.png"),
});
Expand Down
47 changes: 31 additions & 16 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,40 @@ export default defineConfig((options) => {
}),
isElectron && [
cleanDistPlugin(),
electron({
entry: [
"./src/backend/electron/main.ts",
"./src/backend/electron/preload.ts",
],
// ref: https://github.com/electron-vite/vite-plugin-electron/pull/122
onstart: ({ startup }) => {
if (options.mode !== "test") {
startup([".", "--no-sandbox"]);
}
electron([
{
entry: "./src/backend/electron/main.ts",
// ref: https://github.com/electron-vite/vite-plugin-electron/pull/122
onstart: ({ startup }) => {
if (options.mode !== "test") {
startup([".", "--no-sandbox"]);
}
},
vite: {
plugins: [tsconfigPaths({ root: __dirname })],
build: {
outDir: path.resolve(__dirname, "dist"),
sourcemap,
},
},
},
vite: {
plugins: [tsconfigPaths({ root: __dirname })],
build: {
outDir: path.resolve(__dirname, "dist"),
sourcemap,
{
entry: "./src/backend/electron/preload.ts",
onstart({ reload }) {
reload();
},
vite: {
plugins: [tsconfigPaths({ root: __dirname })],
build: {
outDir: path.resolve(__dirname, "dist"),
sourcemap,
rollupOptions: {
output: { inlineDynamicImports: true },
},
},
},
},
}),
]),
],
isBrowser && injectBrowserPreloadPlugin(),
],
Expand Down

0 comments on commit 94924c5

Please sign in to comment.