Skip to content

Commit 5e192d3

Browse files
sylccspotcode
andauthored
Normalized filename in cache (#997)
* normalized filename * Switch to normalizing once in our compile() function, so that the rest of ts-node's codebase only deals with / paths Co-authored-by: Andrew Bradley <[email protected]>
1 parent a1f1584 commit 5e192d3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,9 @@ export function create (rawOptions: CreateOptions = {}): Register {
756756

757757
// Create a simple TypeScript compiler proxy.
758758
function compile (code: string, fileName: string, lineOffset = 0) {
759-
const [value, sourceMap] = getOutput(code, fileName, lineOffset)
760-
const output = updateOutput(value, fileName, sourceMap, getExtension)
759+
const normalizedFileName = normalizeSlashes(fileName)
760+
const [value, sourceMap] = getOutput(code, normalizedFileName, lineOffset)
761+
const output = updateOutput(value, normalizedFileName, sourceMap, getExtension)
761762
outputCache.set(fileName, output)
762763
return output
763764
}

0 commit comments

Comments
 (0)