fix(🐞): correct bootstrap

This commit is contained in:
younglei 2022-07-23 17:12:20 +08:00
parent 0406b1bf67
commit d22104ed12

View File

@ -2,6 +2,7 @@ import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import { createRequire } from 'module'
import { spawn } from 'child_process'
const pkg = createRequire(import.meta.url)('../package.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url))
@ -10,5 +11,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
// For Debug
fs.writeFileSync(path.join(__dirname, '../node_modules/.electron-vite-debug'), '')
// bootstrap
import('../scripts/watch.mjs?debug=vscode')
spawn(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['run', 'dev'], { stdio: 'inherit' })