Skip to content

fix: bundle remark/unified deps to resolve Vitest jsdom compatibility#45

Open
DavidsonRafaelK wants to merge 1 commit into
andi23rosca:mainfrom
DavidsonRafaelK:fix/bundle-deps-vitest-compat
Open

fix: bundle remark/unified deps to resolve Vitest jsdom compatibility#45
DavidsonRafaelK wants to merge 1 commit into
andi23rosca:mainfrom
DavidsonRafaelK:fix/bundle-deps-vitest-compat

Conversation

@DavidsonRafaelK

Copy link
Copy Markdown

Summary

Fixes #27solid-markdown v2 causes TypeError: util.deprecate is not a function when used in Vitest with a jsdom environment.

The root cause is that remark-parse, unified, and other runtime deps are listed under dependencies, so they are not bundled into the library output. Consumers' bundlers have to resolve them directly, and when Vitest resolves micromark (a transitive dep of remark-parse) with the "development" export condition, it pulls in debug → Node.js util — which is externalized in jsdom and breaks.

What changes

Moved all runtime dependencies (remark-parse, remark-rehype, unified, vfile, unist-util-visit, property-information, comma-separated-tokens, space-separated-tokens, style-to-object) from dependencies to devDependencies.

tsup automatically externalizes packages in dependencies but bundles packages in devDependencies. With this change, the entire unified/remark pipeline is bundled into dist/, so consumers never resolve micromark themselves — the issue goes away entirely.

solid-js stays as the only peerDependency, nothing else changes.

Known issues

  • The bundled output size will increase since the remark/unified pipeline is now inlined. This is a tradeoff — most component libraries bundle their deps anyway, and it avoids leaking transitive dependency issues to consumers.
  • pnpm-lock.yaml is not updated in this PR since it would need a fresh pnpm install. The lockfile will be regenerated on the next install.

Notes for review

  • Only package.json is changed — no source code modifications needed.
  • The fix is minimal and targeted: just moving deps between sections, no new dependencies added.
  • Consumers who depend on deduplicating unified or remark-parse with their own copies may see slightly larger bundle sizes, but this is the standard approach for Solid component libraries using tsup-preset-solid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

solid-markdown v2 causes Vitest tests to error

1 participant