Skip to content

Commit

Permalink
use non-querystringed path when changing file extension in `maybeEmit…
Browse files Browse the repository at this point in the history
…Dep`
  • Loading branch information
lobsterkatie committed Nov 17, 2022
1 parent 865777d commit d5e74b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/node-file-trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ export class Job {
} catch (e1: any) {
error = e1;
try {
if (this.ts && dep.endsWith('.js') && e1 instanceof NotFoundError) {
if (this.ts && strippedDep.endsWith('.js') && e1 instanceof NotFoundError) {
// TS with ESM relative import paths need full extensions
// (we have to write import "./foo.js" instead of import "./foo")
// See https://www.typescriptlang.org/docs/handbook/esm-node.html
const depTS = dep.slice(0, -3) + '.ts';
resolved = await this.resolve(depTS, path, this, cjsResolve);
const strippedDepTS = strippedDep.slice(0, -3) + '.ts';
resolved = await this.resolve(strippedDepTS + queryString, path, this, cjsResolve);
error = undefined;
}
} catch (e2: any) {
Expand Down

0 comments on commit d5e74b0

Please sign in to comment.