Generate fails with ERROR [vite]: Rollup failed to resolve import "/res/img/photos/..."

My app is running just fine in dev mode, but when I build, it fails with this error:
ERROR [vite]:
Rollup failed to resolve import "/res/img/photos/photo-27.jpg" from "/Volumes/Data/.../site/pages/blog/index.vue".

This is most likely unintended because it can break your application at runtime.

If you do want to externalize this module explicitly add it to `build.rollupOptions.external`
ERROR [vite]:
Rollup failed to resolve import "/res/img/photos/photo-27.jpg" from "/Volumes/Data/.../site/pages/blog/index.vue".

This is most likely unintended because it can break your application at runtime.

If you do want to externalize this module explicitly add it to `build.rollupOptions.external`
The images are all stored in the public folder, and referenced like this:
<img src="/res/img/photos/photo-27.jpg">
<img src="/res/img/photos/photo-27.jpg">
Am I missing something?
1 Reply
davestewart
davestewartOP2y ago
I think it may be because the images were in /site/modules/theme/runtime/public. When I copy them to /public it builds OK. My folder setup is like this:
+- public <-- dir.public
+- site <-- srcDir
+- modules
+- ...
+- public <-- dir.public
+- site <-- srcDir
+- modules
+- ...
Want results from more Discord servers?
Add your server