In my vue-cli 3 project, I have organized the static assets in the public directory. When compiled and built on localhost, all assets load successfully, except for some images not appearing in the browser.
Despite guyana-live-logo.png, slide-1.jpg, and 970x250-ad.png being loaded correctly, only the logo and ad image show up in the browser as depicted below:
What I've attempted
- Alteration of the image reference method.
Original - works for most images
<img src="/img/slide-1.jpg"/>
Test 0 - appended a hash to the image name (slide-1.1b0ahsa.jpg) but still no display in the browser
<img src="../../../public/img/slides/slide-1.jpg">
Test 1 - used v-bind
<img :src="'/img/slide-1.jpg'"/>
Relocation of the image within the src directory and component sub-directory, both without success.
Updating vue-loader
Production build with sole serving of the /dist folder
Important points
- No errors shown on console or bug tracking tool.
- The image format doesn't seem to be the issue, as some .png/.jpg files load while others don't.
- Some JavaScript files are also affected and called like this:
in public/index.html<script type="text/javascript" src="<%= BASE_URL %>js/script.js"></script>