Use base path for assets during development
See original GitHub issueIs your feature request related to a problem? Please describe.
When using vite
with a traditional backend, it is hard to get the assets right during development. So for example my php site is running under my-app.test
and vite is running under localhost:3000
. To access my vite assets folder (localhost:3000/assets
) I have to create a symlink in my php development server.
Describe the solution you’d like
It would be great If I could specify a base: 'http://localhost:3000/'
during development. So vite will load all my assets from vite’s dev server.
Describe alternatives you’ve considered Another way would be to add an option to explicitly load all assets from vite’s dev server instead of using relative paths.
server: { useFullPath: true }
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
next.js - How to change base path for assets, images, etc
Docs "Files in the public folder; if you want to serve those assets over a CDN, you'll have to introduce the prefix yourself"...
Read more >Public Path - webpack
It allows you to specify the base path for all the assets within your application. Use Cases. There are a few use cases...
Read more >Static Asset Handling - Vite
Then you can place the asset in a special public directory under your project root. Assets in this directory will be served at...
Read more >The Document Base URL element - HTML - MDN Web Docs
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in...
Read more >Using Angular's Base HREF in Paths - Shawn Wildermuth
NET Core project and their asset links would break. Let's look at why this happens and how to address it. The problem comes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The plugin of @olemarius is life savier! Thank you so much, works like a charm.
Not my case yet, but if you have 2 different react apps built with vite and embed in the same website, then I guess you have 2 assets folders to make available through your server configuration and if you have 2 files with the same name then you have a conflict. I don’t think the server configuration is a valid solution.
@olemarius that looks great, thanks for sharing!