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

Add multiple cdn support #9898

Closed
wants to merge 2 commits into from
Closed

Add multiple cdn support #9898

wants to merge 2 commits into from

Conversation

peng
Copy link
Contributor

@peng peng commented Jan 31, 2024

Changes

This is not final PR. If my code is ok, later I will write test and docs.

  • What does this change?

Add build.assetsPrefix is also function.

Astro not support multiple cdn. We disscuss is this issues: #9700 (comment)

I have opened a discussion here: withastro/roadmap#818

Testing

Docs

If my idea and code is ok, later I will write test and docs. If not, please tell me how to modity it. Thanks!

Copy link

changeset-bot bot commented Jan 31, 2024

⚠️ No Changeset found

Latest commit: debbb72

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Jan 31, 2024
@peng peng changed the title Add mult cdn Add multiple cdn support Jan 31, 2024
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

This approach, unfortunately, doesn't work in SSR. My suggestion is to have an object like this:

{
	"default": "https://cdn.example.com",
	"js": "https://cdn-js.example.com",
}

The new logic will match the file extension with the key of the object. If nothing is in there, you can use the default.

@peng
Copy link
Contributor Author

peng commented Feb 19, 2024

This approach, unfortunately, doesn't work in SSR. My suggestion is to have an object like this:

{
	"default": "https://cdn.example.com",
	"js": "https://cdn-js.example.com",
}

The new logic will match the file extension with the key of the object. If nothing is in there, you can use the default.

OK, I will solve it.

@peng peng closed this Feb 19, 2024
@peng peng mentioned this pull request Feb 22, 2024
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) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants