chenyc
2023-09-08 f6d62eaf70440d3183cad494d08a9e8c96c3d9d8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import { createRequire } from 'module'
 
const pkg = createRequire(import.meta.url)('../package.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url))
 
// write .debug.env
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
 
// bootstrap
import('../scripts/watch.mjs?debug=vscode')