Skip to content

fix(themes): declare generated runtime dependencies - #771

Merged
jaywcjlove merged 2 commits into
uiwjs:masterfrom
dahukish:codex/fix-theme-runtime-deps
Sep 24, 2026
Merged

jaywcjlove merged 2 commits into
uiwjs:masterfrom
dahukish:codex/fix-theme-runtime-deps

Conversation

@dahukish

@dahukish dahukish commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Theme packages whose generated ESM/CJS output imports @babel/runtime helpers or @lezer/highlight directly were missing those declarations in package.json. Under bundler configs that don't hoist phantom dependencies — raw webpack, pnpm strict mode, Vite library mode — consumers get a hard module-not-found error at build time.

Closes #755

Summary

  • Declare @babel/runtime: ^7.18.6 in every theme package whose built output emits Babel helper require() calls.
  • Declare @lezer/highlight: ^1.0.0 in every theme package whose source imports tags directly (all except console, which re-exports only from @uiw/codemirror-themes).
  • Add themes/_scripts/check-runtime-dependencies.cjs — scans built esm/ and cjs/ output for imports not declared in package.json and exits non-zero on any gap.
  • Wire the check into .github/workflows/pr.yml after npm run build to prevent regressions.

Note on @babel/runtime

The correct long-term fix is to configure the babel build to use inline helpers instead of @babel/runtime, removing the runtime dependency entirely. That change is out of scope here; this PR declares the existing implicit dependency explicitly.

Test plan

  • npm run build followed by npm run check:theme-dependencies passes
  • Negative test: removing @babel/runtime from themes/basic/package.json causes the check to fail as expected

@dahukish
dahukish force-pushed the codex/fix-theme-runtime-deps branch from 533a490 to 9ec1859 Compare September 24, 2026 16:24
@dahukish

Copy link
Copy Markdown
Contributor Author

Hey @jaywcjlove 👋 — this fixes the Module not found: @babel/runtime crash reported in #755. Theme packages were missing runtime dependency declarations so bundlers without phantom-dep hoisting (raw webpack, pnpm strict mode) would blow up on install.

Two commits: declare the missing deps across all theme packages, and add a CI check to pr.yml that scans built output so it can't regress.

Happy to adjust anything — thanks for taking a look!

@dahukish
dahukish marked this pull request as ready for review September 24, 2026 16:31
@jaywcjlove
jaywcjlove merged commit c0be46f into uiwjs:master Sep 24, 2026
1 check failed
jaywcjlove added a commit that referenced this pull request Sep 24, 2026
github-actions Bot pushed a commit that referenced this pull request Sep 24, 2026
jaywcjlove added a commit that referenced this pull request Sep 24, 2026
github-actions Bot pushed a commit that referenced this pull request Sep 24, 2026
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.

Missing dependency while using raw Webpack config

2 participants