diff --git a/src/index.ts b/src/index.ts index 9a4eddf..7bf148e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,7 +10,7 @@ import { IOptions } from "./ioptions"; import { Partial } from "./partial"; import { parseTsConfig } from "./parse-tsconfig"; import { printDiagnostics } from "./print-diagnostics"; -import { TSLIB, tslibSource, tslibVersion } from "./tslib"; +import { TSLIB, TSLIB_VIRTUAL, tslibSource, tslibVersion } from "./tslib"; import { blue, red, yellow, green } from "colors/safe"; import { dirname, isAbsolute, join, relative } from "path"; import { normalize } from "./normalize"; @@ -125,7 +125,7 @@ const typescript: PluginImpl> = (options) => resolveId(this: PluginContext, importee: string, importer: string | undefined) { if (importee === TSLIB) - return "\0" + TSLIB; + return TSLIB_VIRTUAL; if (!importer) return; @@ -162,7 +162,7 @@ const typescript: PluginImpl> = (options) => load(id: string) { - if (id === "\0" + TSLIB) + if (id === TSLIB_VIRTUAL) return tslibSource; return null; diff --git a/src/tslib.ts b/src/tslib.ts index 3788775..4f58008 100644 --- a/src/tslib.ts +++ b/src/tslib.ts @@ -2,6 +2,7 @@ import { readFileSync } from "fs"; // The injected id for helpers. export const TSLIB = "tslib"; +export const TSLIB_VIRTUAL = "\0tslib.js"; export let tslibSource: string; export let tslibVersion: string; try