Skip to content

fix(excalidraw): load public async chunks from the same origin#3880

Merged
Crash-- merged 1 commit into
masterfrom
fix/excalidraw-public-async-chunks
Jun 8, 2026
Merged

fix(excalidraw): load public async chunks from the same origin#3880
Crash-- merged 1 commit into
masterfrom
fix/excalidraw-public-async-chunks

Conversation

@Crash--

@Crash-- Crash-- commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Set __webpack_public_path__ to the public build path in setupAssetPath.js so Excalidraw's webpack async chunks (browser-fs-access, locales, canvas polyfill) load same-origin.
  • They previously loaded from the cross-origin dev server in the public build and failed, which broke the editor's locale and file open/save in dev.

Summary by CodeRabbit

  • Bug Fixes
    • Resolved asset and webpack chunk loading from incorrect origins in the /public share build to ensure proper same-origin resolution.

@excalidraw/excalidraw code-splits browser-fs-access, its locale
bundles and a canvas polyfill as webpack async chunks loaded from
__webpack_public_path__. In the public build that path points at the
cross-origin main dev server, so the chunks fail to load and the
editor cannot fetch its locale or open and save files. Point the
public build at its own origin. In production it already resolves
there, so this only changes dev behaviour.
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f46218db-6b94-4db4-87cb-747958ae9d0c

📥 Commits

Reviewing files that changed from the base of the PR and between 22b56a2 and 3d73ab5.

📒 Files selected for processing (1)
  • src/modules/views/Excalidraw/setupAssetPath.js

Walkthrough

This pull request updates setupAssetPath.js to compute a shared assetPath based on the current window location and applies it to two separate asset-resolution mechanisms. The change derives assetPath as /public/ when the pathname starts with /public, otherwise /. It assigns this value to window.EXCALIDRAW_ASSET_PATH only when the global is not already set, and additionally configures webpack's __webpack_public_path__ to the same value for the /public build. This ensures Excalidraw's webpack async chunks resolve from the correct origin regardless of the deployment route.

Suggested reviewers

  • rezk2ll
  • zatteo
  • lethemanh
  • JF-Cozy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing webpack async chunk loading from the correct origin in the public Excalidraw build.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/excalidraw-public-async-chunks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@bundlemon

bundlemon Bot commented Jun 5, 2026

Copy link
Copy Markdown

BundleMon

Files updated (2)
Status Path Size Limits
static/js/main.(hash).js
172.3KB (+29B +0.02%) -
public/static/js/public.(hash).js
147.24KB (+18B +0.01%) -
Unchanged files (19)
Status Path Size Limits
static/js/(chunkId).(hash).js
1.49MB -
public/static/js/(chunkId).(hash).js
1.4MB -
static/js/cozy.(hash).js
918.01KB -
public/static/js/cozy.(hash).js
778.4KB -
(hash).js
336.11KB -
public/(hash).js
336.11KB -
services/qualificationMigration.js
283.16KB -
services/dacc.js
262.9KB -
public/static/js/lib-react.(hash).js
43.88KB -
static/js/lib-react.(hash).js
43.88KB -
public/static/css/cozy.(hash).css
31.36KB -
static/css/cozy.(hash).css
31.36KB -
public/static/js/lib-router.(hash).js
21.86KB -
static/js/lib-router.(hash).js
21.86KB -
static/css/main.(hash).css
11.03KB -
public/static/css/public.(hash).css
6.74KB -
manifest.webapp
3.08KB -
index.html
715B -
assets/manifest.json
185B -

Total files change +46B 0%

Groups updated (1)
Status Path Size Limits
**/*.js
12.16MB (+47B 0%) -
Unchanged groups (2)
Status Path Size Limits
**/*.{png,svg,ico}
2.19MB -
**/*.css
163.15KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@Crash-- Crash-- merged commit 193b796 into master Jun 8, 2026
6 checks passed
@Crash-- Crash-- deleted the fix/excalidraw-public-async-chunks branch June 8, 2026 06:56
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.

3 participants