raineorshine / npm-check-updates

Find newer versions of package dependencies than what your package.json allows
Other
9.37k stars 325 forks source link

`semver-utils` isn't exported #1461

Open regseb opened 23 hours ago

regseb commented 23 hours ago

semver-utils is imported in build/index.d.ts. But the library semver-utils isn't in the package.json dependencies.


Steps to Reproduce

Files:

Steps:

  1. npm install
  2. npx tsc --module nodenext index.ts

Current Behavior

node_modules/npm-check-updates/build/index.d.ts:1:24 - error TS2307: Cannot find module 'semver-utils' or its corresponding type declarations.

1 import { SemVer } from 'semver-utils';
                         ~~~~~~~~~~~~~~

Found 1 error in node_modules/npm-check-updates/build/index.d.ts:1

Expected Behavior

No error.

raineorshine commented 22 hours ago

Hi, thanks for reporting.

semver-utils is included in the package.json, but maybe Rollup is not bundling it properly. Do you know how to force Rollup to include a library?

regseb commented 21 hours ago

semver-utils is in the "devDependencies" that aren't published. It should be put in "dependencies".

raineorshine commented 21 hours ago

Vite uses Rollup to automatically tree shake the devDependencies and bundle them for production.

https://github.com/raineorshine/npm-check-updates/blob/main/vite.config.mts

raineorshine commented 21 hours ago

I'm sure it's just a matter of adding it to the Vite config. I'll play around with it next chance I get :).