Skip to content

Commit

Permalink
fix: mode引数の時の問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Feb 12, 2025
1 parent 7961807 commit 5b9ed1f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,15 @@ export default defineConfig((options) => {
onstart: ({ startup }) => {
console.log("main process build is complete.");
if (!skipLaunchElectron) {
// ここのprocess.argvは["node", ".../vite.js", "--", その他引数]の形式で渡ってくる。
// ここのprocess.argvは以下のような形で渡ってくる:
// ["node", ".../vite.js", (...vite用の引数...), "--", その他引数...]
const args: string[] = [".", "--no-sandbox"];
const extraArgv = process.argv.slice(2);
if (extraArgv.length > 0) {
if (extraArgv[0] !== "--") {
throw new Error(
`Invalid arguments: ${extraArgv.join(" ")}`,
);
}
args.push("--", ...extraArgv.slice(1));
const doubleSeparatorIndex = process.argv.indexOf("--");
if (doubleSeparatorIndex !== -1) {
args.push(
"--",
...process.argv.slice(doubleSeparatorIndex + 1),
);
}
void startup(args);
}
Expand Down

0 comments on commit 5b9ed1f

Please sign in to comment.