diff --git a/src/backend/electron/main.ts b/src/backend/electron/main.ts index 1889dee3ec..63edb176a1 100644 --- a/src/backend/electron/main.ts +++ b/src/backend/electron/main.ts @@ -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"), }); diff --git a/vite.config.mts b/vite.config.mts index 0fd3ea438c..9facc3df44 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -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(), ],