Skip to content

[9.x] Add Vite asset path generation method - #44037

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
wilsenhc:9.x
Sep 7, 2022
Merged

taylorotwell merged 1 commit into
laravel:9.xfrom
wilsenhc:9.x

Conversation

@wilsenhc

@wilsenhc wilsenhc commented Sep 7, 2022

Copy link
Copy Markdown
Contributor

This PR adds a method to the Vite class so the the way the asset URLs are generated can be separated from the main class.

This would make it so Teams/Projects that have their own way of loading assets can extend the functionality of the Vite class and add their own method of loading assets.

This would ease the path of migrations from Laravel-Mix to Vite for those teams.

The assetPath() method has the same signature as the global asset() helper

@taylorotwell
taylorotwell merged commit de80ce6 into laravel:9.x Sep 7, 2022
@timacdonald

Copy link
Copy Markdown
Member

Just note that the vite-plugin uses the ASSET_URL under the hood as well, so swapping this may not work as intended.

I'd recommend just setting the ASSET_URL in your different teams as needed.

@peterjthomson

Copy link
Copy Markdown

I'd recommend just setting the ASSET_URL in your different teams as needed.

Just FYI, a delta between the asset URL and the physical folder can be weird, annoying and confusing. But it's the whole point of this (and similar optional customisations) in webpack / mix. For example shared hosting often has weird symlinks and rules around public folders. These types of customisations help the build pipeline for those developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants