Add .js extension to virtual tslib (#170)

This commit is contained in:
Mateusz Burzyński 2019-09-09 22:56:07 +02:00 committed by Eugene Zolenko
parent 07d9a9c0dc
commit dca40becaf
2 changed files with 4 additions and 3 deletions

View File

@ -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<Partial<IOptions>> = (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<Partial<IOptions>> = (options) =>
load(id: string)
{
if (id === "\0" + TSLIB)
if (id === TSLIB_VIRTUAL)
return tslibSource;
return null;

View File

@ -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