Skip to content

Commit 7740921

Browse files
authored
Merge pull request #10 from jakeklassen/master
handle tsconfig source map options
2 parents 9e325c2 + 76ec874 commit 7740921

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/index.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,27 @@ function getTSConfig() {
3030
type TSConfig = ReturnType<typeof getTSConfig>["tsConfig"];
3131

3232
function esBuildSourceMapOptions(tsConfig: TSConfig) {
33-
if (!tsConfig.options.sourceMap) {
33+
const { sourceMap, inlineSources, inlineSourceMap } = tsConfig.options;
34+
35+
// inlineSources requires either inlineSourceMap or sourceMap
36+
if (inlineSources && !inlineSourceMap && !sourceMap) {
3437
return false;
3538
}
36-
return tsConfig.options.inlineSourceMap ? "inline" : "external";
39+
40+
// Mutually exclusive in tsconfig
41+
if (sourceMap && inlineSourceMap) {
42+
return false;
43+
}
44+
45+
if ((inlineSources && sourceMap) || sourceMap) {
46+
return "external";
47+
}
48+
49+
if (inlineSourceMap) {
50+
return "inline";
51+
}
52+
53+
return false;
3754
}
3855

3956
function getBuildMetadata(userConfig: Config) {

0 commit comments

Comments
 (0)