#@nestjs/typeorm brings typescript even npm i --production flag

1 messages · Page 1 of 1 (latest)

vague pewter
#

After having @nestjs/typeorm in npm package.json, npm i --production includes typescript module even typescript is supposed to be eliminated by devDependencies. typescript module is so big and I do not want to include it in production package especially in lambda & lambda layer deployment.

proud finch
vague pewter
#

I also checked the package.json, indeed typescript is in devDependencies, but you can generate the issue by going through the steps below:

  1. git clone https://github.com/nestjs/typescript-starter.git .
  2. npm i @nestjs/typeorm
  3. rm -rf node_modules
  4. npm i --production
  5. du -sh node_modules/* | grep 'typescript'
feral otter
#

which version of NPM are you using?

proud finch
#

Looks like typeorm depends opn ts-niode which depends on typescript. This is a problem with typeorm, not @nestjs/typeorm

#

npm is resolving the peer dependency automatically, which is why this is happening btw

feral otter
#

oh right because it's not a hard dep

vague pewter
#

Thank you for finding the root cause. Is it the issue on typeorm or ts-node?

feral otter
#

both are fine

#

it's a NPM issue

#

yarn install --production went fine. No typescript on my node_modules

#

even npm install --omit=dev --omit=peer still installs typescript
idk how to ignore that peer then

minor cove
#

Npm will automatically install peer deps if they're not already installed and not marked as optional in peerDepemdenciesMeta

vague pewter
#

what is the root cause in this case? There is no issue with NestJS starter kit.

#

I do not know here to raise the issue.

feral otter
vague pewter
#

I assume TypeORM really need TypeScript in peerDependencies. Regardless I may better off switching to a different module such as Prisma or Sequlize as TypeORM is not well-maintaned (so many issues on GitHub)

minor cove
#

Yep, typeorm is a hot mess