fix(observability-plugin): gate dev channels outside production#4746
Conversation
🦋 Changeset detectedLatest commit: 9df464b 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 |
a9858e7
into
module-federation:pre-release/2.5
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e161823447
ℹ️ 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".
| typeof process === 'undefined' || | ||
| !process.env || | ||
| typeof process.env.NODE_ENV === 'undefined' | ||
| ) { | ||
| return false; |
There was a problem hiding this comment.
Treat missing NODE_ENV as non-production
shouldUseDevelopmentChannels now returns false whenever process/process.env.NODE_ENV is unavailable, which disables both notifyCollector and notifyDevtools in browser runtimes that do not expose process (common with modern ESM tooling). In those environments, even explicit debug activation (FEDERATION_DEBUG or browser debug storage) cannot reach the local collector/devtools path, so development observability regresses outside production despite this change being intended only to block production.
Useful? React with 👍 / 👎.
What changed
This updates the observability plugin so the local collector and devtools notification channels only run outside production mode.
Why
The local collector is a development-only path. In production, it should not attempt to notify the local collector or browser devtools channel.
Impact
Production pages will skip those development notification channels. Debug/local collector behavior remains available outside production mode.
Validation
pnpm --filter @module-federation/observability-plugin run test -- --runInBandpnpm exec prettier --check packages/observability-plugin/src/core.ts packages/observability-plugin/__tests__/observability.spec.ts .changeset/quiet-collector-debug.mdpnpm --filter @module-federation/observability-plugin run lintpnpm --filter @module-federation/observability-plugin run buildpython .codex/skills/changeset-pr/scripts/run_changeset_status.py --verbose