Last CLI with Vite 4.2.2 static assets are not working images not found!

I have installed the last version of CLI and I see the webpack is eliminated and replaced with Vite.

Now my static assets are not found anymore with Vite… images not found with cordova iOS build… my older folder I used for my static assets was src/static/ with webpack bundler with Vite the static folder is not working anymore!

How can I still work with my static folder with Vite and include my local images and language translations json as it was before the update with Vite?

Any ideas?

use the public directory

1 Like

Read README.MD, Vite has different structure

Yes I have read the file already! but the problem still persist! my src folder has my custom images, backgrounds and locales for language, see image:

everything is inside src when I run the development server locally

npm run start

the images are loaded perfectly on localhost

but when I run:

npm run build-cordova-ios

all inside src/static folder is not found! images on the Xcode simulator are not being found! also the locales .json not found.

when I check the folder cordova/www If it is was generated correctly I see only this structure assets and index:

is this structure correct with Vite? because it seems the content is not correctly generated inside cordova/www

so my question is now… why in localhost there is no issues with the static folder and in cordova when I see the app on simulator it does not find anything?

can you confirm?

move static folder from src to the public folder

1 Like

OK, I will do that!
and see what happens when for running the app on localhost and then in cordova!

I will post feedback soon!

Yes it works now! Tested made with localhost and cordova!

solution it is:

use the public directory instead of src/ folder!

big thanks!