How can I reference images outside sourceCodeDir? #460
Replies: 3 comments
-
That's the recommended approach.
It's an unusual configuration, but as mentioned in <%= vite_image_tag '/assets/images/test.svg' %> Otherwise, it will attempt to resolve to the Regarding JS imports, read about Import Aliases and the example in |
Beta Was this translation helpful? Give feedback.
-
Regretfully, this just doesn't work. It makes no difference if I refer to the images with a leading slash or not. The images just aren't loaded by I have read all the documentation multiple times, and tried everything I could think of. I'll just resort to moving all the images. |
Beta Was this translation helpful? Give feedback.
-
Quick fix that worked for me is dump all the images inside |
Beta Was this translation helpful? Give feedback.
-
Hello, I figured I'd open a new question as the old item is already marked as answered, so not getting a lot of traction.
Could someone please provide a concrete working example for how to get images working from the
/app/assets/images
folder when thesourceCodeDir
is/app/javascript
, in a Rails project?I have tried a lot of different things, but can't seem to get it to work unless I move the images into the
/app/javascript
folder.vite.json
Note: I have tried this with or without the
additionalEntryPoints
Image tags
This is not working
Direct import
This is not working, unless using a resolve alias
Any suggestions would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions