feat: source map support via source-map-support
This commit is contained in:
parent
0ab8274afe
commit
f12e36c935
3 changed files with 6 additions and 1 deletions
|
@ -19,6 +19,8 @@ export const load = createRequire(
|
|||
};
|
||||
export const { cache } = load;
|
||||
|
||||
load<any>("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");
|
||||
}
|
||||
|
|
1
package-lock.json
generated
1
package-lock.json
generated
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue