Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ namespace ts {

// Create a compilerHost object to allow the compiler to read and write files
const compilerHost: CompilerHost = {
getSourceFile: (fileName, target) => fileName === normalizeSlashes(inputFileName) ? sourceFile : undefined,
getSourceFile: (fileName, target) => fileName === normalizePath(inputFileName) ? sourceFile : undefined,
writeFile: (name, text, writeByteOrderMark) => {
if (fileExtensionIs(name, ".map")) {
Debug.assert(sourceMapText === undefined, `Unexpected multiple source map outputs for the file '${name}'`);
Expand Down
7 changes: 6 additions & 1 deletion tests/cases/unittests/transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ var x = 0;`,
it("Supports backslashes in file name", () => {
test("var x", { expectedOutput: `"use strict";\r\nvar x;\r\n`, options: { fileName: "a\\b.ts" }});
});

it("transpile file as 'tsx' if 'jsx' is specified", () => {
let input = `var x = <div/>`;
let output = `"use strict";\nvar x = React.createElement("div", null);\n`;
Expand All @@ -286,6 +286,7 @@ var x = 0;`,
options: { compilerOptions: { jsx: JsxEmit.React, newLine: NewLineKind.LineFeed } }
})
});

it("transpile .js files", () => {
const input = "const a = 10;";
const output = `"use strict";\nvar a = 10;\n`;
Expand All @@ -295,5 +296,9 @@ var x = 0;`,
expectedDiagnosticCodes: []
});
})

it("Supports urls in file name", () => {
test("var x", { expectedOutput: `"use strict";\r\nvar x;\r\n`, options: { fileName: "http://somewhere/directory//directory2/file.ts" } });
});
});
}