Skip to content

Comments

Fix relative worker path for non-root deployments#786

Merged
cwillisf merged 1 commit intoscratchfoundation:developfrom
exblocks:fix/relative-worker-path
Feb 2, 2026
Merged

Fix relative worker path for non-root deployments#786
cwillisf merged 1 commit intoscratchfoundation:developfrom
exblocks:fix/relative-worker-path

Conversation

@yokobond
Copy link
Contributor

Resolves

Fixes issue where fetch-worker.* files are placed in root-level https://<server>/chunks/ when scratch-editor is deployed to a non-root path, causing worker loading failures.

Proposed Changes

This Pull Request modifies the webpack configuration to use relative paths for chunk loading instead of absolute paths. The key change is setting publicPath: 'auto' in the webpack configuration, which ensures that:

  • Worker files (fetch-worker.*) are loaded relative to the deployed application path
  • Chunks are properly resolved when scratch-editor is deployed to subdirectories
  • The application works correctly regardless of deployment path

Reason for Changes

When scratch-editor is deployed to a non-root path (e.g., https://example.com/my-app/), the current configuration places worker chunks at the server root (https://example.com/chunks/) instead of relative to the application (https://example.com/my-app/chunks/). This causes:

  • 404 errors when trying to load worker files
  • Application failures in subdirectory deployments
  • Deployment flexibility issues

By using relative paths, the worker files will be correctly located relative to where the main application is deployed, ensuring compatibility with various deployment scenarios.

@yokobond yokobond marked this pull request as ready for review August 15, 2025 10:57
@cwillisf cwillisf merged commit 00cec69 into scratchfoundation:develop Feb 2, 2026
1 check passed
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

🎉 This PR is included in version 6.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants