From dca40becaf35eb7322e69724183114e8a2af6b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Mon, 9 Sep 2019 22:56:07 +0200 Subject: [PATCH] Add .js extension to virtual tslib (#170) --- src/index.ts | 6 +++--- src/tslib.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) 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