Skip to content

chore(third-party-dts-extractor): replace resolve with exsolve#4775

Open
gu-stav wants to merge 2 commits into
module-federation:mainfrom
gu-stav:chore/drop-resolve-extractor
Open

chore(third-party-dts-extractor): replace resolve with exsolve#4775
gu-stav wants to merge 2 commits into
module-federation:mainfrom
gu-stav:chore/drop-resolve-extractor

Conversation

@gu-stav
Copy link
Copy Markdown
Contributor

@gu-stav gu-stav commented May 28, 2026

The single resolve.sync() call (a ${pkg}/package.json lookup) is swapped for exsolve's resolveModulePath.

exsolve ships with zero transitive dependencies and weighs ~100KB less than resolve's 161KB + 6 transitives (path-parse, is-core-module, function-bind, hasown, supports-preserve-symlinks-flag, es-define-property). The package is already in the lockfile as a transitive of pkg-types, so the install footprint goes down without adding a new top-level entry.

The single `resolve.sync()` call (a `${pkg}/package.json` lookup) is
swapped for `exsolve`'s `resolveModulePath`. `exsolve` ships with zero
transitive dependencies and weighs ~100KB less than `resolve`'s
161KB + 6 transitives.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 28, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit ab8784b
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a18042355655600089aa3bd
😎 Deploy Preview https://deploy-preview-4775--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: ab8784b

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

This PR includes changesets to release 46 packages
Name Type
@module-federation/third-party-dts-extractor Patch
@module-federation/dts-plugin Patch
@module-federation/cli Patch
@module-federation/enhanced Patch
@module-federation/manifest Patch
@module-federation/metro Patch
@module-federation/rspack Patch
@module-federation/modern-js-v3 Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspress-plugin Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/runtime Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/esbuild Patch
@module-federation/observability-plugin Patch
@module-federation/utilities 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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8ba2b6ec7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

import { existsSync, readFileSync } from 'fs';
import path from 'path';
import resolve from 'resolve';
import { resolveModulePath } from 'exsolve';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep CJS build from requiring ESM-only exsolve

When this package is loaded through its existing require export, tsup leaves dependencies external by default, so the generated CJS file will require exsolve at module load time. exsolve@1.0.8 is ESM-only (type: module with only a .mjs export), so CommonJS consumers will hit ERR_REQUIRE_ESM before ThirdPartyExtractor can run; either keep a CJS-compatible resolver or explicitly bundle/noExternal exsolve for the CJS build.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a follow-up commit to address the issue 👍🏼

`exsolve@1.0.8` is ESM-only (`type: module`, single `.mjs` export). Left
external by tsup's default, CJS consumers (including
`@module-federation/dts-plugin`'s own CJS build, which is what
`@module-federation/vite` actually loads) hit `ERR_REQUIRE_ESM` on
module load before `ThirdPartyExtractor` can run.

Split tsup config so the CJS build sets `noExternal: ['exsolve']` while
the ESM build keeps it as a runtime dep. CJS dist grows ~41KB; ESM is
unchanged.
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.

1 participant