Skip to content

Commit dca40be

Browse files
Andaristezolenko
authored andcommitted
Add .js extension to virtual tslib (#170)
1 parent 07d9a9c commit dca40be

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IOptions } from "./ioptions";
1010
import { Partial } from "./partial";
1111
import { parseTsConfig } from "./parse-tsconfig";
1212
import { printDiagnostics } from "./print-diagnostics";
13-
import { TSLIB, tslibSource, tslibVersion } from "./tslib";
13+
import { TSLIB, TSLIB_VIRTUAL, tslibSource, tslibVersion } from "./tslib";
1414
import { blue, red, yellow, green } from "colors/safe";
1515
import { dirname, isAbsolute, join, relative } from "path";
1616
import { normalize } from "./normalize";
@@ -125,7 +125,7 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
125125
resolveId(this: PluginContext, importee: string, importer: string | undefined)
126126
{
127127
if (importee === TSLIB)
128-
return "\0" + TSLIB;
128+
return TSLIB_VIRTUAL;
129129

130130
if (!importer)
131131
return;
@@ -162,7 +162,7 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
162162

163163
load(id: string)
164164
{
165-
if (id === "\0" + TSLIB)
165+
if (id === TSLIB_VIRTUAL)
166166
return tslibSource;
167167

168168
return null;

src/tslib.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { readFileSync } from "fs";
22

33
// The injected id for helpers.
44
export const TSLIB = "tslib";
5+
export const TSLIB_VIRTUAL = "\0tslib.js";
56
export let tslibSource: string;
67
export let tslibVersion: string;
78
try

0 commit comments

Comments
 (0)