question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use base path for assets during development

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pjoulotcommented, Jul 9, 2021

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.

1reaction
arnosoncommented, Mar 8, 2021

@olemarius that looks great, thanks for sharing!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found