Closed Ferm0494 closed 10 months ago
For some reason after the typescript compiles it adds to node_modules/nestjs-i18n/dist/utils/index.js
this line:
__exportStar(require("./typescript"), exports);
Probably the solution is to add this:
"exclude": ["node_modules", "**/*.spec.ts", "src/utils/typescript.ts"]
to tsconfig.build.json
.
For now, anyone who has this issue has two options:
dependencies
in your package.json
and run a project__exportStar(require("./typescript"), exports);
in node_modules/nestjs-i18n/dist/utils/index.js
Really hard to do option 2 in Docker, I've opted for option 1, working perfectly.
You can always use https://www.npmjs.com/package/patch-package
You can add this file nestjs-i18n+10.3.1.patch
to your patches directory with this content:
diff --git a/node_modules/nestjs-i18n/dist/utils/index.js b/node_modules/nestjs-i18n/dist/utils/index.js
index 13bca8b..d1d0300 100644
--- a/node_modules/nestjs-i18n/dist/utils/index.js
+++ b/node_modules/nestjs-i18n/dist/utils/index.js
@@ -18,6 +18,5 @@ __exportStar(require("./context"), exports);
__exportStar(require("./file"), exports);
__exportStar(require("./format"), exports);
__exportStar(require("./merge"), exports);
-__exportStar(require("./typescript"), exports);
__exportStar(require("./util"), exports);
//# sourceMappingURL=index.js.map
\ No newline at end of file
And check about postinstall to apply the changes.
My lamda function (serverless fm and github actions) gave this error, and patch fixed it.
npm i patch-package
github action file
- name: Apply Patches
run: npx patch-package
I also have the same app deployed elsewhere there I install typescript as a global dependecy so it works as well.
This issue also breaks Heroku deployments because devDependencies are removed on production builds.
For me, reverting to version 10.2.6 works.
Had the same issue, installed typescript as a regular dependency solved the problem. Looking forward a prettier solution in the future.
Lets add this to docs
I have added a section to the docs https://nestjs-i18n.com/faq/common#cannot-find-module-typescript . If there are any other viable solution , let me know so I can add them there as well
Thank you for maintaining this lib. Just a little comment from our perspective here:
We cannot use option 2 from the docs as our project is deployed automatically by a pipeline somewhere into the cloud (no access for us). We do not need typescript as a production dependency and do not want to add it "artificially" because of this issue. Therefore, we will stick to version 10.2.6 for the moment.
Would like to know the perspective of other consumers for sure.. :)
I think something broke on the current version. I will have to write a test to see if I can roll this change back
This seems to be fixed with the https://github.com/toonvanstrijp/nestjs-i18n/pull/565 . You can try the latest version
Describe the bug
When building Docker Images, we exclude devDependencies such as
typescript
found in/utils/typescript.js
, had to be included to production dependencies in order to make the tree flowReproduction
yarn install --production
System Info
Used Package Manager
yarn
Validations