Skip to content

Commit

Permalink
feat: sandboxを有効化 (#2074)
Browse files Browse the repository at this point in the history
* feat: sandboxを有効化

* fix: コメント追加

Co-authored-by: Hiroshiba <hihokaruta@gmail.com>

---------

Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
sabonerune and Hiroshiba authored Jun 26, 2024
1 parent 5eb01a9 commit 2b059d4
Show file tree
Hide file tree
Showing 2 changed files with 32 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
48 changes: 32 additions & 16 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,41 @@ 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,
{
// ref: https://electron-vite.github.io/guide/preload-not-split.html
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 2b059d4

Please sign in to comment.