Skip to content

feat: add resolveBuiltUrl hook#1675

Closed
aleclarson wants to merge 3 commits into
vitejs:mainfrom
aleclarson:feat/resolveBuiltUrl
Closed

feat: add resolveBuiltUrl hook#1675
aleclarson wants to merge 3 commits into
vitejs:mainfrom
aleclarson:feat/resolveBuiltUrl

Conversation

@aleclarson
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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. 👍

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

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

@yacinehmito
Copy link
Copy Markdown

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
Comment thread packages/vite/src/node/plugins/asset.ts Outdated
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-cat
Copy link
Copy Markdown
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
Copy Markdown
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