fix(node): report HTTP failures before evaluating remote scripts#4811
fix(node): report HTTP failures before evaluating remote scripts#4811dmchoi77 wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: 241c892 The changes in this PR will be included in the next version bump. This PR includes changesets to release 46 packages
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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@module-federation/devtools
@module-federation/cli
create-module-federation
@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/metro-plugin-rock
@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/observability-plugin
@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: |
Bundle Size Report16 package(s) changed, 25 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 6.83 MB (+12.3 kB (+0.2%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
Description
This fixes Node.js remote script loading paths so non-ok HTTP responses are reported before their response bodies are evaluated as JavaScript.
Previously, when a Node remote entry or federated runtime chunk returned an HTTP error response such as 404 or 503, the loader could read the response body and attempt to evaluate it as JavaScript. That could surface a confusing syntax error such as
Unexpected identifierinstead of the actual HTTP failure.This change:
@module-federation/sdk.@module-federation/node.@module-federation/sdkand@module-federation/node.Tested with Node.js
v20.19.5:corepack pnpm --filter @module-federation/sdk run testcorepack pnpm --filter @module-federation/node run testcorepack pnpm --filter @module-federation/sdk run buildcorepack pnpm --filter @module-federation/node run buildcorepack pnpm --filter @module-federation/sdk run lintcorepack pnpm --filter @module-federation/node run lintcorepack pnpm exec prettier --check packages/sdk/src/node.ts packages/sdk/__tests__/node-http-status.spec.ts packages/node/src/runtimePlugin.ts packages/node/src/__tests__/runtimePlugin.test.ts .changeset/quiet-node-loader-status.mdRelated Issue
Fixes #4810
Types of changes
Checklist