Skip to content

Commit

Permalink
Add .js extension to virtual tslib (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored and ezolenko committed Sep 9, 2019
1 parent 07d9a9c commit dca40be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/tslib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dca40be

Please sign in to comment.