Fix relative worker path for non-root deployments #786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves
Fixes issue where
fetch-worker.*
files are placed in root-levelhttps://<server>/chunks/
whenscratch-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:fetch-worker.*
) are loaded relative to the deployed application pathscratch-editor
is deployed to subdirectoriesReason 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: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.