diff --git a/framework/hot.ts b/framework/hot.ts index a7bd652..f5c909e 100644 --- a/framework/hot.ts +++ b/framework/hot.ts @@ -19,6 +19,8 @@ export const load = createRequire( }; export const { cache } = load; +load("source-map-support").install({hookRequire: true}); + // Register extensions by overwriting `require.extensions` const require = load; const exts = require.extensions; @@ -138,7 +140,7 @@ function loadEsbuildCode( import.meta.url = ${JSON.stringify(pathToFileURL(filepath).toString())}; import.meta.dirname = ${JSON.stringify(path.dirname(filepath))}; import.meta.filename = ${JSON.stringify(filepath)}; - `.trim().replace(/\n/g, "") + src; + `.trim().replace(/[\n\s]/g, "") + src; } src = esbuild.transformSync(src, { loader, @@ -148,6 +150,7 @@ function loadEsbuildCode( jsxImportSource: "#ssr", jsxDev: true, sourcefile: filepath, + sourcemap: 'inline', }).code; return module._compile(src, filepath, "commonjs"); } diff --git a/package-lock.json b/package-lock.json index f83bc1a..98344cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "marko": "^6.0.20", "puppeteer": "^24.10.1", "sharp": "^0.34.2", + "source-map-support": "^0.5.21", "unique-names-generator": "^4.7.1", "vscode-oniguruma": "^2.0.1", "vscode-textmate": "^9.2.0" diff --git a/package.json b/package.json index 6f7c941..5cbd7e6 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "marko": "^6.0.20", "puppeteer": "^24.10.1", "sharp": "^0.34.2", + "source-map-support": "^0.5.21", "unique-names-generator": "^4.7.1", "vscode-oniguruma": "^2.0.1", "vscode-textmate": "^9.2.0"