Skip to content

Commit

Permalink
Normalized filename in cache (#997)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
sylc and cspotcode committed Apr 20, 2020
1 parent a1f1584 commit 5e192d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,9 @@ export function create (rawOptions: CreateOptions = {}): Register {

// Create a simple TypeScript compiler proxy.
function compile (code: string, fileName: string, lineOffset = 0) {
const [value, sourceMap] = getOutput(code, fileName, lineOffset)
const output = updateOutput(value, fileName, sourceMap, getExtension)
const normalizedFileName = normalizeSlashes(fileName)
const [value, sourceMap] = getOutput(code, normalizedFileName, lineOffset)
const output = updateOutput(value, normalizedFileName, sourceMap, getExtension)
outputCache.set(fileName, output)
return output
}
Expand Down

0 comments on commit 5e192d3

Please sign in to comment.