Skip to content
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

Updates hydration scripts to use absolute paths #3422

Merged
merged 5 commits into from
May 23, 2022

Conversation

tony-sull
Copy link
Contributor

Closes #2561

Changes

This updates hydration scripts to use absolute paths when importing scripts. This is necessary to make sure any client-hydrated scripts on a custom 404 page are loaded properly

Testing

Updated existing tests and added two new ones to confirm this behavior when config.base is used to deploy to subpaths

Docs

None, bug fix only

@changeset-bot
Copy link

changeset-bot bot commented May 23, 2022

🦋 Changeset detected

Latest commit: 7b72f3a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 23, 2022
@tony-sull tony-sull self-assigned this May 23, 2022
@matthewp
Copy link
Contributor

@tony-sull think there's just a few tests needing to be updated.

@tony-sull
Copy link
Contributor Author

@matthewp gotta love good test coverage! There was a legit Windows bug in there that the test caught, the PR wasn't forcing posix paths in the build's resolve() call 👍

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Woohoo! Great fix.

@tony-sull tony-sull merged commit 0209d62 into main May 23, 2022
@tony-sull tony-sull deleted the hydration-script-absolute-path branch May 23, 2022 20:52
@github-actions github-actions bot mentioned this pull request May 24, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* WIP: proof of concept fix to use absolute paths

* correct fix to handle absolute paths and config.base

* adding tests for hydration scripts with config.base

* chore: add changeset

* fix: ensure posix paths are used for Windows compat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 BUG: Generated relative paths for assets causes 404 pages to render incorrectly
3 participants