Skip to content

Commit 723e64b

Browse files
committed
Add js source maps to list of outputs when doing --build
Fixes microsoft#26619
1 parent 9106fdb commit 723e64b

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/compiler/tsbuild.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,16 @@ namespace ts {
317317
}
318318

319319
const outputs: string[] = [];
320-
outputs.push(getOutputJavaScriptFileName(inputFileName, configFile));
320+
const js = getOutputJavaScriptFileName(inputFileName, configFile);
321+
outputs.push(js);
322+
if (configFile.options.sourceMap) {
323+
outputs.push(`${js}.map`);
324+
}
321325
if (getEmitDeclarations(configFile.options) && !fileExtensionIs(inputFileName, Extension.Json)) {
322326
const dts = getOutputDeclarationFileName(inputFileName, configFile);
323327
outputs.push(dts);
324328
if (configFile.options.declarationMap) {
325-
outputs.push(dts + ".map");
329+
outputs.push(`${dts}.map`);
326330
}
327331
}
328332
return outputs;
@@ -334,11 +338,14 @@ namespace ts {
334338
}
335339
const outputs: string[] = [];
336340
outputs.push(project.options.outFile);
341+
if (project.options.sourceMap) {
342+
outputs.push(`${project.options.outFile}.map`);
343+
}
337344
if (getEmitDeclarations(project.options)) {
338345
const dts = changeExtension(project.options.outFile, Extension.Dts);
339346
outputs.push(dts);
340347
if (project.options.declarationMap) {
341-
outputs.push(dts + ".map");
348+
outputs.push(`${dts}.map`);
342349
}
343350
}
344351
return outputs;

src/testRunner/unittests/tsbuild.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ namespace ts {
55
const projFs = loadProjectFromDisk("tests/projects/sample1");
66

77
const allExpectedOutputs = ["/src/tests/index.js",
8-
"/src/core/index.js", "/src/core/index.d.ts",
9-
"/src/logic/index.js", "/src/logic/index.d.ts"];
8+
"/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map",
9+
"/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts"];
1010

1111
describe("tsbuild - sanity check of clean build of 'sample1' project", () => {
1212
it("can build the sample project 'sample1' without error", () => {
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"composite": true,
4-
"declaration": true
4+
"declaration": true,
5+
"declarationMap": true
56
}
67
}

tests/projects/sample1/logic/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"composite": true,
44
"declaration": true,
5+
"sourceMap": true,
56
"forceConsistentCasingInFileNames": true
67
},
78
"references": [

0 commit comments

Comments
 (0)