Skip to content

Commit d30e7cc

Browse files
chore: fix relative path in sourcemap
This commit contains two changes: - the `src/index.ts` file is now included in the published package - the path in the sourcemap files is now valid Interestingly, the path is already valid in the `dist/lib/index.js.map` file, due to the additional `lib/` directory. Related: niklasvh#32
1 parent 47fe6a8 commit d30e7cc

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@
5050
"tslint-config-prettier": "^1.18.0",
5151
"typescript": "^4.3.5"
5252
},
53-
"keywords": []
53+
"keywords": [],
54+
"files": [
55+
"src/",
56+
"dist/"
57+
]
5458
}

rollup.config.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,29 @@ const banner = `/*
1212
* Released under ${pkg.license} License
1313
*/`;
1414

15+
// transform "../../src/index.ts" (invalid) into "../src/index.ts"
16+
const sourcemapPathTransform = (sourcePath) => {
17+
return sourcePath.substring('../'.length);
18+
};
19+
1520
export default {
1621
input: `src/index.ts`,
1722
output: [
18-
{ file: pkg.main, name: pkg.name, format: 'umd', banner, sourcemap: true },
19-
{ file: pkg.module, format: 'esm', banner, sourcemap: true },
23+
{
24+
file: pkg.main,
25+
name: pkg.name,
26+
format: 'umd',
27+
banner,
28+
sourcemap: true,
29+
sourcemapPathTransform,
30+
},
31+
{
32+
file: pkg.module,
33+
format: 'esm',
34+
banner,
35+
sourcemap: true,
36+
sourcemapPathTransform,
37+
},
2038
],
2139
external: [],
2240
watch: {

0 commit comments

Comments
 (0)