diff --git a/.vscode/.debug.script.mjs b/.vscode/.debug.script.mjs index 99857c3..a315617 100644 --- a/.vscode/.debug.script.mjs +++ b/.vscode/.debug.script.mjs @@ -1 +1,14 @@ -import '../scripts/watch.mjs?debug=vscode' \ No newline at end of file +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')