diff --git a/package.json b/package.json index 4b0b5a4..5baff16 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "@types/node": "14.14.10", "@types/prettier": "2.1.5", "@types/rimraf": "3.0.0", + "@types/source-map-support": "^0.5.3", "@typescript-eslint/eslint-plugin": "4.9.0", "@typescript-eslint/parser": "4.9.0", "devmoji": "2.1.12", @@ -97,6 +98,7 @@ "prettier": "2.2.1", "release-it": "14.2.2", "rimraf": "3.0.2", + "source-map-support": "^0.5.19", "type-fest": "0.20.2", "typescript": "4.1.2", "typesync": "0.8.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c545b6c..2a37e5b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,7 @@ devDependencies: '@types/node': 14.14.10 '@types/prettier': 2.1.5 '@types/rimraf': 3.0.0 + '@types/source-map-support': 0.5.3 '@typescript-eslint/eslint-plugin': 4.9.0_e74d2a7d9c6f761fcb488002f3c93903 '@typescript-eslint/parser': 4.9.0_eslint@7.15.0+typescript@4.1.2 devmoji: 2.1.12 @@ -24,6 +25,7 @@ devDependencies: prettier: 2.2.1 release-it: 14.2.2 rimraf: 3.0.2 + source-map-support: 0.5.19 type-fest: 0.20.2 typescript: 4.1.2 typesync: 0.8.0 @@ -864,6 +866,12 @@ packages: dev: true resolution: integrity: sha512-7WhJ0MdpFgYQPXlF4Dx+DhgvlPCfz/x5mHaeDQAKhcenvQP1KCpLQ18JklAqeGMYSAT2PxLpzd0g2/HE7fj7hQ== + /@types/source-map-support/0.5.3: + dependencies: + source-map: 0.6.1 + dev: true + resolution: + integrity: sha512-fvjMjVH8Rmokw2dWh1dkj90iX5R8FPjeZzjNH+6eFXReh0QnHFf1YBl3B0CF0RohIAA3SDRJsGeeUWKl6d7HqA== /@types/stack-utils/2.0.0: dev: true resolution: @@ -7294,6 +7302,7 @@ specifiers: '@types/node': 14.14.10 '@types/prettier': 2.1.5 '@types/rimraf': 3.0.0 + '@types/source-map-support': ^0.5.3 '@typescript-eslint/eslint-plugin': 4.9.0 '@typescript-eslint/parser': 4.9.0 devmoji: 2.1.12 @@ -7312,6 +7321,7 @@ specifiers: prettier: 2.2.1 release-it: 14.2.2 rimraf: 3.0.2 + source-map-support: ^0.5.19 type-fest: 0.20.2 typescript: 4.1.2 typesync: 0.8.0 diff --git a/src/esbuild.ts b/src/esbuild.ts index af847c2..71d6bf9 100644 --- a/src/esbuild.ts +++ b/src/esbuild.ts @@ -43,7 +43,7 @@ function _transform(code: string, filename: string): string { logLevel: "error", target: [`node${process.version.slice(1)}`], minify: false, - sourcemap: true, + sourcemap: "inline", sourcefile: filename, }) return ret.code @@ -66,7 +66,7 @@ function _bundle(code: string, filename: string): string { format: "cjs", target: [`node${process.version.slice(1)}`], minify: false, - sourcemap: true, + sourcemap: "inline", write: false, }) .outputFiles.map((f) => f.text) diff --git a/src/register.ts b/src/register.ts index 18c0eae..5fe3e9c 100644 --- a/src/register.ts +++ b/src/register.ts @@ -1,2 +1,5 @@ +import { install as installSourceMapSupport } from "source-map-support" import { install } from "./hook" + +installSourceMapSupport({ hookRequire: true }) install()