From 16fa852c1dfb7206a88abd690ee94db2b51bfb98 Mon Sep 17 00:00:00 2001 From: bluelovers Date: Wed, 3 Nov 2021 16:10:20 +0800 Subject: [PATCH] fix(tslib): https://github.com/ezolenko/rollup-plugin-typescript2/issues/286 --- package.json | 1 + src/tslib.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1d7658a3..9d389126 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ }, "dependencies": { "@rollup/pluginutils": "^4.1.0", + "@yarn-tool/resolve-package": "^1.0.36", "find-cache-dir": "^3.3.1", "fs-extra": "8.1.0", "resolve": "1.20.0", diff --git a/src/tslib.ts b/src/tslib.ts index 4f58008b..92c294c1 100644 --- a/src/tslib.ts +++ b/src/tslib.ts @@ -8,8 +8,9 @@ export let tslibVersion: string; try { // tslint:disable-next-line:no-string-literal no-var-requires - const tslibPackage = require("tslib/package.json"); - const tslibPath = require.resolve("tslib/" + tslibPackage.module); + const _ = require("@yarn-tool/resolve-package").resolvePackage('tsdx'); + const tslibPackage = _.pkg; + const tslibPath = _.resolveLocation(tslibPackage.module); tslibSource = readFileSync(tslibPath, "utf8"); tslibVersion = tslibPackage.version; } catch (e)