Conversation
Co-authored-by: zackary.l.jackson <zackary.l.jackson@gmail.com>
Use tsdown with nx run-commands for migrated packages and align export and type outputs for publint. Remove legacy rollup configs and add shared migration scaffolding. Co-authored-by: Cursor <cursoragent@cursor.com>
Align package build metadata with tsdown output and type extension updates. Remove CJS fallback from ESM runtime alias resolution for consistent module format selection. Co-authored-by: Cursor <cursoragent@cursor.com>
Use .d.mts for import types so exports match emitted ESM declaration files. Co-authored-by: Cursor <cursoragent@cursor.com>
# Conflicts: # .cursorignore
Co-authored-by: zackary.l.jackson <zackary.l.jackson@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/data-prefetch
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
|
@codex review this pr |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Remove runtime candidate arrays and fallback probing. Select exactly one plugin file per build: plugin.js for ESM, plugin.cjs for CJS.
- rslib.config: define process.env.IS_ESM_BUILD per format (true for esm, false for cjs) - ModuleFederationPlugin: remove runtime candidate-array resolution - Use deterministic branch on IS_ESM_BUILD for runtime-tools and runtime paths - .js for ESM build, .cjs for CJS build - Keep implementationPath and require.resolve paths behavior - Preserve useful error message with specifier, paths, and original error
… tests - Remove instantiate() call after link() in ConfigTestCases.rstest.ts Node's link() already performs instantiation; calling instantiate() on a linked module throws in Node 20+ - Add status checks for cached ESM modules: return early when evaluated, skip link when already linked - Apply same instantiate() removal in asModule.js helper for consistency
|
@codex deep research for bugs |
Summary
Testing
Skipped checks (and why)
|
❌ Deploy Preview for module-federation-docs failed. Why did it fail? →
|
Bundle Size Report11 package(s) changed, 30 unchanged.
Total dist: 6.71 MB (+6.5 kB (+0.1%)) |
|
@codex review pr |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ecaacd542
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| let requireFn: NodeRequire; | ||
| if (process.env['IS_ESM_BUILD'] === 'true') { | ||
| if (process.env.IS_ESM_BUILD === 'true') { |
There was a problem hiding this comment.
Use bracket access for undeclared IS_ESM_BUILD env key
packages/sdk/tsconfig.json enables noPropertyAccessFromIndexSignature, and NodeJS.ProcessEnv in this package does not declare IS_ESM_BUILD; using process.env.IS_ESM_BUILD here raises TS4111 during type/declaration builds. Since sdk builds with tsdown + dts.resolver: 'tsc', this can break the package build unless the env key is declared in ProcessEnv or accessed via process.env['IS_ESM_BUILD'].
Useful? React with 👍 / 👎.
| const runtimeToolsSpec = `@module-federation/runtime-tools/dist/index${ext}`; | ||
| const bundlerRuntimeSpec = `@module-federation/webpack-bundler-runtime/dist/index${ext}`; | ||
| const runtimeSpec = `@module-federation/runtime/dist/index${ext}`; |
There was a problem hiding this comment.
Restore legacy runtime entry fallbacks for implementation path
This change hardcodes runtime resolution to dist/index.{js,cjs} only, removing the previous fallback set for legacy entry names and package-root resolution. In mixed-version setups (especially when implementation points to older runtime packages), require.resolve can now fail during plugin initialization, which prevents runtime alias wiring and breaks federation startup.
Useful? React with 👍 / 👎.
Description
This PR refactors internal path resolution in several packages to leverage
process.env.IS_ESM_BUILDfor compile-time format detection, eliminating runtime heuristics and string replacements. This ensures thattsdowncan perform dead code elimination, resulting in CJS and ESM build outputs that contain only the paths and logic relevant to their respective module formats.Specifically:
nextjs-mf: Replaced string replacement and runtime path candidates with compile-timeif (process.env.IS_ESM_BUILD === 'true')blocks to hardcode.mjsor.jspaths fornext-fragmentsandruntimePlugin.node: UpdatedUniversalFederationPluginto useprocess.env.IS_ESM_BUILDfor selectingruntimePlugin.mjsorruntimePlugin.js.sdk: Modifiednode.tsto useprocess.env.IS_ESM_BUILDfor correctrequirevscreateRequirehandling.This change guarantees that the generated
distfiles for CJS and ESM builds are correctly tree-shaken and contain only the necessary code.Related Issue
Addresses feedback and comments from PR #4460.
Types of changes
Checklist