DEV Community

Discussion on: Create react app vs Vite

Collapse
 
jamesthomson profile image
James Thomson

I've recently switched a Vue CLI project to Vite. It's impressive how fast things are - but makes complete sense when there's no build step needed when developing.

One thing I've found less intuitive are images, especially dynamically referenced ones (e.g. in a loop). I've had to create a utility for this:

export function getImageUrl (name) {
  return new URL(`../assets/${name}`, import.meta.url).href;
}
Enter fullscreen mode Exit fullscreen mode

Is this also the case in React?

Collapse
 
keefdrive profile image
Keerthi

Yes , Similar in react