Skip to content

Conversation

@davidfirst
Copy link
Member

@davidfirst davidfirst commented Oct 17, 2025

Summary

Remove all core environments from Bit's core binary to reduce size and node_modules footprint. All previous core envs (node, react, aspect, mdx, etc.) are now regular dependencies instead of bundled core aspects.

Created teambit.envs/empty-env as the new default environment - a minimal env with no compiler, tester, or other tools, solving the chicken-and-egg problem of needing a default env during early initialization.

Changes

Core Envs Removed from manifests.ts

  • AspectAspect
  • MDXAspect
  • ReadmeAspect
  • EnvAspect
  • NodeAspect
  • ReactAspect

New Empty Env Created

  • teambit.envs/empty-env - minimal empty environment as new default
  • Changed DEFAULT_ENV from teambit.harmony/node to teambit.envs/empty-env
  • Added EmptyEnvAspect to manifests.ts as core aspect

Backward Compatibility

  • Added getLegacyCoreEnvsIds() listing all 9 legacy core envs
  • Enhanced resolveEnv() to handle legacy core envs with version resolution
  • Updated getCoreEnvsIds() to include empty-env plus legacy core envs
  • Modified getDefaultEnv() and all calling locations for proper error handling

Documentation

  • Created comprehensive docs/removing-core-envs.md documenting the implementation

Benefits

  • Reduced binary size - core envs no longer bundled
  • Smaller node_modules - only needed envs are installed
  • Backward compatible - old components continue to work
  • No breaking changes - version assignment is transparent
  • Cleaner architecture - clear separation between core aspects and envs

Testing

Verified with bbit:

  • ✅ Compile (301 components)
  • ✅ Status
  • ✅ Empty env registered as core aspect
  • ✅ Default env works without Node installed

Notes

Draft PR as bit status needs additional work to function properly.

Remove all core environments from Bit's core binary to reduce size and node_modules footprint. All previous core envs (node, react, aspect, mdx, etc.) are now regular dependencies.

Created teambit.envs/empty-env as the new default environment - a minimal env with no compiler, tester, or other tools, solving the chicken-and-egg problem of needing a default env during early initialization.

Key changes:
- Removed 6 core env aspects from manifests.ts
- Added empty-env as new core aspect
- Changed DEFAULT_ENV from teambit.harmony/node to teambit.envs/empty-env
- Enhanced backward compatibility for legacy core envs
- Updated getDefaultEnv() and all calling locations
- Added comprehensive documentation
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.

2 participants