Skip to content

fix: dedupe solid-js in production builds - #440

Open
lxsmnsyc wants to merge 2 commits into
mainfrom
fix/112-dedupe-build-main
Open

lxsmnsyc wants to merge 2 commits into
mainfrom
fix/112-dedupe-build-main

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

Fixes #112 on main (1.x). The fix for next is in a separate PR.

Production builds now include one copy of solid-js when a dependency brings its own version. Before, resolve.dedupe was only set for the dev server, so builds could bundle two copies.

Changes

  • resolve.dedupe for solid-js is now set for every command, not only serve.
  • optimizeDeps.include stays dev-only.

Testing

  • Reproduced with an app on solid-js 1.9.17 and a dependency carrying 1.9.16.
    • Vite 8 bundled both copies. With the fix it bundles one.
    • On Vite 5 the bundle shrinks from 24,003 to 17,882 bytes.
  • Added a regression test that fails without the fix.
  • vitest run and tsc --noEmit pass. The vite-5, vite-6 and vite-8 examples build.

Note on the first commit

main had no unit tests. The first commit adds the same Vitest setup that next uses: a root vitest.config.ts, a test:unit script, and a step in the Vitest workflow. The other main fix PRs from this batch (#112, #153, #206, #130, #141) share this exact commit, so they do not conflict on it.

🤖 Generated with Claude Code

lxsmnsyc and others added 2 commits October 19, 2026 11:34
- Add a root vitest config and a test:unit script, matching the next branch.
- Run the unit tests in the vitest workflow.
- Exclude test files from the declaration build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- resolve.dedupe was only set while serving, so a dependency with its own nested solid-js copy was bundled twice in production.
- Dedupe solid-js in every command. optimizeDeps.include stays dev only.
- Add a build test with a nested solid-js copy.

Fixes #112

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 62e2b75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vite-plugin-solid Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/vite-plugin-solid@440

commit: 62e2b75

@ryansolid ryansolid added the 1.x label Oct 21, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

solid-js is being bundled twice in production and not in dev

2 participants