Skip to content

UI: Use local Monaco editor module instead of CDN#66647

Open
parkhojeong wants to merge 8 commits into
apache:mainfrom
parkhojeong:fix/ui-bundle-monaco-editor
Open

UI: Use local Monaco editor module instead of CDN#66647
parkhojeong wants to merge 8 commits into
apache:mainfrom
parkhojeong:fix/ui-bundle-monaco-editor

Conversation

@parkhojeong
Copy link
Copy Markdown
Contributor

@parkhojeong parkhojeong commented May 10, 2026

Issue

Environments without internet access could not load monaco

Code tab Details Tab Trigger Dag params
image image image

Repro

See a UI with Monaco, such as the Code tab in Dag details, without internet access.

Chrome: 2 options

Root Cause

monaco was already present in the dependency tree through @monaco-editor/react, but Airflow did not
import or configure it directly. As a result, the Monaco loader fell back to its default CDN path at runtime.

  airflow-core/src/airflow/ui/node_modules/.pnpm/@monaco-editor+loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/config/index.js:1

  var config = {
    paths: {
      vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs'
    }
  };

Fix

This change wires the existing Monaco package into the UI bundle explicitly and declares it as a direct
dependency because the Airflow UI now imports it directly.

Lazy loading was also applied to Monaco package.

The existing Monaco runtime is loaded from CDN at version 0.52.2, so this PR keeps the bundled dependency aligned with that version. Any Monaco version upgrade should be handled in a separate PR.

Code tab Details Tab Trigger Dag params
image image image
Test code Fixed(Minor)

The selector for line number elements in the Dag code page test was too broad. This updates it to target the actual Monaco line numbers. In Firefox E2E, .monaco-editor .line-numbers also matches a hidden textAreaCover element before the visible line numbers.
You can use console.log(await this.page.locator(".monaco-editor").evaluate((el) => el.outerHTML)); after await this.waitForCodeReady();

browser monaco dom structure
<div class="monaco-editor ..." ...>
   ...
  <div class="margin-view-overlays">
    <div style="...">
       <div class="current-line" ...></div>
        <div  class="line-numbers active-line-number" ...>1</div>
      </div>
  </div>
</div>
firefox e2e dom structure
<div class="monaco-editor ..." ...>
    <div class="overflow-guard">
      <textarea class="inputarea ..."></textarea>
      <div class="... line-numbers" ...></div>

      <div class="margin">
        <div class="margin-view-overlays">
          <div>
            <div class="current-line"></div>
            <div class="line-numbers active-line-number">1</div>
          </div>
          <div>
            <div class="line-numbers">2</div>
          </div>
        </div>
      </div>
    </div>
  </div>

Was generative AI tooling used to co-author this PR?
  • Yes (codex gpt-5.5)

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label May 10, 2026
@parkhojeong parkhojeong changed the title Fix/UI bundle monaco editor UI: Stop loading Monaco editor from CDN May 10, 2026
@parkhojeong parkhojeong marked this pull request as ready for review May 10, 2026 15:48
@parkhojeong parkhojeong changed the title UI: Stop loading Monaco editor from CDN UI: Use local Monaco editor module instead of CDN May 10, 2026
Copy link
Copy Markdown
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is now vendored in? If so -> information about it should be placed in approproate NOTICE File - detailing the verion and licence see Chakra and hue example in there.

Copy link
Copy Markdown
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "request changes".

@parkhojeong
Copy link
Copy Markdown
Contributor Author

parkhojeong commented May 11, 2026

This code is now vendored in? If so -> information about it should be placed in approproate NOTICE File - detailing the verion and licence see Chakra and hue example in there.

@potiuk

Thanks for catching this!

I added it to airflow-core/LICENSE and airflow-core/3rd-party-licenses/LICENSE-monaco-editor.txt. I left NOTICE unchanged because there is no modified Monaco portion or separate required notice. 52cdc39

@parkhojeong parkhojeong requested a review from potiuk May 11, 2026 02:47
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 11, 2026
@parkhojeong
Copy link
Copy Markdown
Contributor Author

parkhojeong commented May 12, 2026

#66589 is similar to #66020, so I updated the PR description with closes: #66020, #66589.

@bbovenzi bbovenzi added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label May 13, 2026
@bbovenzi bbovenzi added this to the Airflow 3.2.2 milestone May 13, 2026
@choo121600
Copy link
Copy Markdown
Member

@potiuk Could you review this again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code is loading and never shown

4 participants