-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat: add assetsBase
config to support serving assets from CDN
#2467
base: main
Are you sure you want to change the base?
Conversation
One question regarding the middleware part, do people have use cases where they will be using an internal PS: Not sure about the naming too, |
Sure, such use case is rare. But in mine, we deploy the assets to CDN in production environment while together in test environment. For example: export default {
base: '/app-name/',
publicPath:
process.env.DEPLOY_ENV === 'production'
? 'https://cdn.example.com/assets/app-name/'
: '/assets/app-name/'
} It is necessary to add the middleware if we want to locally preview the test environment build. As to the naming of I will rename it to |
By the way, the new middleware is only used when the |
assetsBase
config to support serving assets from CDN
3fcd8f5
to
832b3aa
Compare
Rebased. |
I had the same problem and look forward to its release |
832b3aa
to
6d461be
Compare
6d461be
to
1912a3a
Compare
7ad4a4e
to
f0d3082
Compare
I'm also interested in this and look forward to its release. |
Looking forward to its release. |
Looking forward to it very much |
1912a3a
to
77ff8a7
Compare
Rebased on And fix formatting. |
a0d8475
to
d2e8a3b
Compare
什么时候才会合并 |
Looking forward to its release. |
Thank you all for hard work and contributions! I wanted to check in on this PR as this feature is crucial for us to use the tool in our production environment. Is there anything I can do to help move this forward? Any feedback or additional changes needed? I’m more than happy to assist in any way possible. |
This comment was marked as duplicate.
This comment was marked as duplicate.
An example of a configuration code that changes the VitePress resource URLs to absolute URLs I use this configuration code to speed up the access to static resources. You can refer to it https://github.com/gkd-kit/docs/blob/main/docs/.vitepress/plugins/mirror.ts Additionally, if you do not want to modify the VitePress configuration code, another solution is to use a service worker to implement resource redirection. |
How is the progress now? |
Any progress? |
I think this is an important feature. Please pay more attention to this PR! 🙏🏻 |
ca85384
to
0062073
Compare
Rebased on main branch and add docs for other languages. |
refactor: rename `publicPath` option to `assetsBase`
e59e9bc
to
00aef2a
Compare
Looking forward to its release |
Add the
publicPath
site config to support serving assets from CDN.For example, we can deploy the pages to
https://www.example.com/
and the assets tohttps://cdn.example.com/assets/
with the following config:When running
vitepress preview
, use an additional middleware to redirect the non-default asset requests to the files underassets
directory.May resolve #736 and #2144