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..2f296734 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('tslib'); + const tslibPackage = _.pkg; + const tslibPath = _.resolveLocation(tslibPackage.module); tslibSource = readFileSync(tslibPath, "utf8"); tslibVersion = tslibPackage.version; } catch (e)