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

Preserve base slash when trailingSlash ignore #7878

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jul 31, 2023

Changes

fix #6623

When trailingSlash is set to ignore, the import.meta.env.BASE_URL will have a string that's the same as config.base as-is. Unlike always where it always adds a trailing slash, and unlike never where it'll never have a trailing slash.

Since the issue was created, looks like docs now document the old, different behaviour:

By default, the value of import.meta.env.BASE_URL includes a trailing slash. If you have the trailingSlash option set to 'never', you will need to add it manually in your static asset imports and URLs.

where ignore would work like always (Always have a trailing slash). Perhaps we should discuss if this change makes sense?

Testing

Updated some tests to fix the old behaviour, the rest should still pass.

Docs

Added changelog, and updated docs in astro.ts
/cc @withastro/maintainers-docs for feedback!

@changeset-bot
Copy link

changeset-bot bot commented Jul 31, 2023

🦋 Changeset detected

Latest commit: 044acba

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

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 Jul 31, 2023
@bluwy bluwy marked this pull request as draft July 31, 2023 14:43
@bluwy bluwy force-pushed the base-trailing-slash-ignore branch from dd0b9ad to c4cd8d6 Compare August 1, 2023 13:55
@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Aug 1, 2023
@bluwy bluwy force-pushed the base-trailing-slash-ignore branch from c4cd8d6 to 8441295 Compare August 1, 2023 14:36
@github-actions github-actions bot removed the pkg: integration Related to any renderer integration (scope) label Aug 1, 2023
@bluwy bluwy force-pushed the base-trailing-slash-ignore branch from 8441295 to c97e57d Compare August 2, 2023 07:47
@bluwy bluwy force-pushed the base-trailing-slash-ignore branch from c97e57d to 5775b4f Compare August 4, 2023 08:48
@bluwy bluwy marked this pull request as ready for review August 4, 2023 09:35
@bluwy bluwy requested a review from a team as a code owner August 4, 2023 14:43
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks @bluwy! Left some changeset and docs comments.

.changeset/six-grapes-look.md Outdated Show resolved Hide resolved
.changeset/six-grapes-look.md Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
@bluwy bluwy force-pushed the base-trailing-slash-ignore branch from 4bad885 to 044acba Compare August 8, 2023 15:30
@bluwy
Copy link
Member Author

bluwy commented Aug 9, 2023

Merging this in as the examples check is blocked by #7998

@bluwy bluwy merged commit 0f637c7 into next Aug 9, 2023
13 of 14 checks passed
@bluwy bluwy deleted the base-trailing-slash-ignore branch August 9, 2023 09:02
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.

None yet

3 participants