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

feat: add resolveBuiltUrl hook #1675

Closed
wants to merge 3 commits into from

Conversation

aleclarson
Copy link
Member

For rewriting the public URLs of static assets.

Used by vite-plugin-rehost and vite-plugin-public.

aleclarson added a commit to aleclarson/vite that referenced this pull request Jan 23, 2021
...and any local non-module `<script>` tags.

This is especially useful in combination with vitejs#1675.
@airhorns
Copy link
Contributor

This makes a lot of sense -- for anyone that wants to do 0 downtime deploys, uploading the assets to some shared global store is super key. 👍

packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
@Shinigami92 Shinigami92 added the p2-nice-to-have Not breaking anything but nice to have (priority) label Mar 23, 2021
@aleclarson
Copy link
Member Author

Note: This depends on #3032 for CSS urls to be supported.

@yacinehmito
Copy link

This is also very relevant for existing projects that might not want static assets handling.

@aleclarson aleclarson force-pushed the feat/resolveBuiltUrl branch from d735562 to f325977 Compare April 19, 2021 23:42
aleclarson added a commit to aleclarson/vite that referenced this pull request Oct 4, 2021
… in the facade module

This commit allows for assets in ./public/ to have their URLs transformed at build time, making plugins like vite-plugin-public and vite-plugin-rehost possible.

Depends on vitejs#1675
aleclarson added a commit to aleclarson/vite that referenced this pull request Oct 4, 2021
… in the facade module

This commit allows for assets in ./public/ to have their URLs transformed at build time, making plugins like vite-plugin-public and vite-plugin-rehost possible.

Depends on vitejs#1675
aleclarson added a commit to aleclarson/vite that referenced this pull request Oct 4, 2021
… in the facade module

This commit allows for assets in ./public/ to have their URLs transformed at build time, making plugins like vite-plugin-public and vite-plugin-rehost possible.

Depends on vitejs#1675
aleclarson added a commit to aleclarson/vite that referenced this pull request Oct 4, 2021
… in the facade module

This commit allows for assets in ./public/ to have their URLs transformed at build time, making plugins like vite-plugin-public and vite-plugin-rehost possible.

Depends on vitejs#1675
@patak-dev
Copy link
Member

For reference, this PR was discussed and approved in a team meeting. We need tests to be able to merge it. If someone wants this in, please PR a test case to this branch.

@bluwy
Copy link
Member

bluwy commented Apr 1, 2023

I think this is supported through experimental.resolveBuiltUrl now, when that is out of experimental, we can revisit if it makes sense to be a new hook.

I also don't quite understand the usecase of hashing public files. Public files are copied as-is, if assets needs to be hashed, they should be out of the publicDir so Vite can transform it.

@bluwy bluwy closed this Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs test p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants