Skip to content

perf(CodeEditor): lazy load all languages - #6909

Merged
jsulpis merged 4 commits into
mainfrom
codemirror-perf
Sep 17, 2026
Merged

jsulpis merged 4 commits into
mainfrom
codemirror-perf

Conversation

@jsulpis

@jsulpis jsulpis commented Sep 11, 2026

Copy link
Copy Markdown
Member

Summary

CodeEditor previously bundled every language grammar (total ~530kB minzipped) via @uiw/codemirror-extensions-langs.

Now languages are lazy-loaded on demand:

  • @codemirror/language-data resolves languages by extension and import()s them only when used.
  • nix, svelte, solidity (missing from language-data) added via @replit/codemirror-lang-*.
  • extensions is now a typed LanguageName union; unknown values fall back to sh (unchanged).

Dropped @uiw/codemirror-extensions-langs and updated the renovate CodeMirror matcher.

Note: the only functional change should be that the python extension is no longer recognized (other python extensions like py or pyw still work). It was mapped by @uiw/codemirror-extensions-langs but it's not in @codemirror/language-data. I checked in the console that only .py is used.

How to test

Baseline in prod:

  1. go to https://storybook.ultraviolet.scaleway.com/?path=/story/compositions-codeeditor--playground
  2. open the network tab
  3. see a huge CodeEditor js chunk
  4. when changing the language in the playground ("rs", "py", "lua"...) you should not see new js files downloaded because all languages are already in the initial chunk

Lazy-load in preview:

  1. go to https://ultravioletjxvhzygy-codemirrorperfstorybook.functions.fnc.fr-par.scw.cloud/?path=/story/compositions-codeeditor--playground
  2. open the network tab
  3. see a much smaller CodeEditor js chunk
  4. when changing the language in the playground ("rs", "py", "lua"...) you should see new js files downloaded on demand

You can check the solidity, nix and svelte languages that are loaded differently from the others

@jsulpis jsulpis added the enhancement New feature or request label Sep 11, 2026
@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b08396

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@ultraviolet/ui Patch
@ultraviolet/form Patch
@ultraviolet/nextjs Patch

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

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.73%. Comparing base (c63be91) to head (4b08396).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6909      +/-   ##
==========================================
- Coverage   90.97%   83.73%   -7.25%     
==========================================
  Files         572       48     -524     
  Lines       10532      744    -9788     
  Branches     3798      204    -3594     
==========================================
- Hits         9582      623    -8959     
+ Misses        950      121     -829     

see 524 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57c8d0d...4b08396. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread packages/ui/src/compositions/CodeEditor/type.ts
Comment thread packages/form/src/compositions/CodeEditorField/__tests__/index.test.tsx Outdated
@jsulpis
jsulpis merged commit 7857bbc into main Sep 17, 2026
13 of 14 checks passed
@jsulpis
jsulpis deleted the codemirror-perf branch September 17, 2026 09:17
@github-actions github-actions Bot mentioned this pull request Sep 17, 2026

This branch was successfully deployed

1 active deployment
storybook 4b083966 Deployed Sep 17, 2026 by scaleway-bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants