Skip to content

chore(deps): dedupe vite installations#16788

Merged
ematipico merged 1 commit into
withastro:mainfrom
ocavue-forks:ocavue/dedupe-vite-types-node
May 20, 2026
Merged

chore(deps): dedupe vite installations#16788
ematipico merged 1 commit into
withastro:mainfrom
ocavue-forks:ocavue/dedupe-vite-types-node

Conversation

@ocavue

@ocavue ocavue commented May 19, 2026

Copy link
Copy Markdown
Contributor

Changes

This is a follow-up to #16787.

The goal of this PR is ensure that we only get one instance of vite installed under node_modules/.

In general, it's okay to have multiple installations of the same package under node_modules/ (which is why npm is better than some other package managers like Python pip), but occasionally you do encounter some tricky TypeScript type-checking issues and JavaScript runtime instanceof issues because of this.

I made the following changes in this PR:

  • Dedupe direct @types/node dep:
    • Update @types/node from v20 to v22 in language tools packages. VSCode uses Node v22 since 2025 June, so it should be safe to update this.
    • Downgrade @types/node from v25 to v22 in the CF package. It's better not to use non-LTS versions anyway.
  • Dedupe indirect @types/node peer dep:
    • Enabled pnpm dedupePeers config.
    • Added pnpm override to @types/node. See the inline comment in my code for more details.

Testing

Here is how I check my work is correct:

Before:

Two instances of vite installed. One with @types/node@25.2.3 and another with @types/node@22.19.11.

$ git branch --show-current
main

# How many packages installed 
$ pnpm i
$ pnpm ls --parseable | wc -l
802

# How many vite installed 
$ pnpm -r why vite | grep -v ''
vite@7.3.2 peer#8113 (2 variations)
vite@7.3.2 peer#cdd9 (2 variations)
Found 1 version, 2 instances of vite

# Get vite install path
$ pnpm ls --parseable | grep '.pnpm/vite@'
/node_modules/.pnpm/vite@7.3.2_@types+node@25.2.3_jiti@2.6.1_lightningcss@1.32.0_sass@1.98.0_tsx@4.21.0_yaml@2.8.3/node_modules/vite
/node_modules/.pnpm/vite@7.3.2_@types+node@22.19.11_jiti@2.6.1_lightningcss@1.32.0_sass@1.98.0_tsx@4.21.0_yaml@2.8.3/node_modules/vite

After:

Singe instance of vite installed, with @types/node@22.19.19.

$ git branch --show-current

# How many packages installed 
$ pnpm i
$ pnpm ls --parseable | wc -l
798

# How many vite installed 
$ pnpm -r why vite | grep -v ''
vite@7.3.2
Found 1 version of vite

# Get vite install path
/node_modules/.pnpm/vite@7.3.2_@types+node@22.19.19_jiti@2.6.1_lightningcss@1.32.0_sass@1.98.0_tsx@4.21.0_yaml@2.8.3/node_modules/vite

I was thinking about adding a new test to ensure that we only have one vite installed, but it's a bit overkill, IMHO. After all, having multiple vite installations won't necessarily cause issues.

Docs

N/A

@changeset-bot

changeset-bot Bot commented May 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f67f970

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label May 19, 2026
@ocavue ocavue force-pushed the ocavue/dedupe-vite-types-node branch from 8ee6ced to f67f970 Compare May 20, 2026 01:35
@ocavue ocavue marked this pull request as ready for review May 20, 2026 01:56
@ocavue ocavue changed the title chore(deps): dedupe peer dependencies chore(deps): dedupe vite installations May 20, 2026
@ematipico ematipico merged commit 8062391 into withastro:main May 20, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants