Skip to content

Fix relative worker path for non-root deployments #786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

yokobond
Copy link

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
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.

1 participant