uuidjs / uuid

Generate RFC-compliant UUIDs in JavaScript
MIT License
14.61k stars 901 forks source link

[BUG] Installing `uuid` has an inconsistent dependency chain causing build issues in ci/cd pipelines #745

Closed samuelhulla closed 7 months ago

samuelhulla commented 7 months ago

Before you begin...

Description of the problem

Hey, there seems to be an issue with installation of the uuid for ci/cd pipelines.

The types are shown and exported correctly in the IDE and also on a dev server, but when building in a ci/cd pipeline this produces an error

Error: src/components/recipients/AddRecipients.tsx(2,20): error TS7016: Could not find a declaration file for module 'uuid'. '/home/runner/work/censored-path/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/uuid if it exists or add a new declaration (.d.ts) file containing declare module 'uuid';  ELIFECYCLE  Command failed with exit code 2.

Recipe for reproducing

1. Setup a node project _(in my case vite)_
2. add `uuid` (i.e. `pnpm add uuid`)
3. run the project (start the project _in my case `vite dev`_)
4. See the dev server and IDE passes
5. Run the build localy in a ci/cd pipeline _(github workflow `vite build`)_ 
6. See the error produce _(issue description above)_

Additional information

It seems like the package uuid has an internal dependency on types uuid. However installing it should either

  1. not require installing @types/uuid as part of the dev dependencies
  2. or just full on declare and install as part of devDependencies

Right now it looks like the package is in an identity crisis of being stuck between js and ts and there's a resolution issue between both.

Environment

Just using an excerpt of relevant packages, since it's on a large project that has 80+ deps

uuid: ^9.0.1 => 9.0.1
samuelhulla commented 7 months ago

Actually on second thought, might be an issue with tsc resolution displaying inconsistent behaviour during build time, rather than the package itself.

broofa commented 7 months ago

Closing. If you'd like us to reopen: