As the root tsconfig is using "importHelpers": true, the tsc -p . command outputs code which tries to import code from tslib package. See the lib/index.js file for example
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./injectSlack"), exports);
tslib_1.__exportStar(require("./slackConstants"), exports);
tslib_1.__exportStar(require("./slackModule"), exports);
tslib_1.__exportStar(require("./slackOptions"), exports);
//# sourceMappingURL=index.js.map
Since tslib is not added as a dependency of nestjs-slack-webhook, environments that don’t already have tslib installed (or use package managers like pnpm that strictly scope sub-dependencies) cannot load nestjs-slack-webhook and fail with a Cannot find module 'tslib' error.
I am currently working around this issue by using a custom patch to add tslib as a dependency (the patch was created for v10 hence the nestjs 10 import, but the issue exists with v11 and the patch also still works):
diff --git a/package.json b/package.json
index fd795e3d6fcbf54ea1e9217abb7d97db99bfff15..4f1196d49e61a61efd6b5bc532ca54e011dadc13 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,9 @@
"nest",
"slack-webhook"
],
+ "dependencies": {
+ "tslib": "2.8.1"
+ },
"peerDependencies": {
"@nestjs/common": "^10.0.0",
"@slack/webhook": "^6.0.0 || ^7.0.0"
Simply adding tslib as a dependency to the packages should fix this issue.
As the root tsconfig is using
"importHelpers": true, thetsc -p .command outputs code which tries to import code fromtslibpackage. See thelib/index.jsfile for exampleSince tslib is not added as a dependency of
nestjs-slack-webhook, environments that don’t already havetslibinstalled (or use package managers like pnpm that strictly scope sub-dependencies) cannot loadnestjs-slack-webhookand fail with aCannot find module 'tslib' error.I am currently working around this issue by using a custom patch to add
tslibas a dependency (the patch was created for v10 hence the nestjs 10 import, but the issue exists with v11 and the patch also still works):Simply adding
tslibas a dependency to the packages should fix this issue.