question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<v-card-media> images are not proccess in Vue Loader with "npm run build"

See original GitHub issue

Hi! i’ve deploy my aplicacion with npm run build of Vue Loader, but I see that the image in the v-card-media component is not processed unlike other tags “img”,etc Code 1 Scalfolding 2 npm run build 3

Sorry for my english! 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

15reactions
vwxyzjncommented, Aug 17, 2017

I believe @jyacot wants to do relative URLs static assets imports. Usually, relative URLs are automatically enabled. For example, in the official vuejs template we can see

<img src="./assets/logo.png">

According to the vue-loader’s documentation, the markup above is actually translated to

createElement('img', { attrs: { src: require('../image.png') }})

which is something VCardMedia.js doesn’t have. It simply uses whatever url you passed into src prop of v-card-media component

style: {
  background: `url(${this.src}) center center / ${this.contain ? 'contain' : 'cover'} no-repeat`
}

If you want a quick fix however, try

v-card-media(
  class="white--text"
  :src="require('@/assets/yourimages.jpg')"
  height="200px"
)

This solved my problem.

@johnleider I believe this is a common gotchas since vue-template encourages you to use relative imports (see Handing Static Assets). Would you consider adding it to the official Frequently asked questions | Vuetify?

14reactions
vwxyzjncommented, Aug 18, 2017

@johnleider Check out this minimal reproduction: v-card-media_relative_import.

Review especially these lines

And the result looks like this:

image

Notice directly using relative import on <v-card-media> doesn’t work the same way <img> does. In <img>, you can write:

<img src="./v.png"/>

while for <v-card-media> you need to write

<v-card-media v-bind:src="require('./v.png')" height="200px">
<!-- <v-card-media src="./v.png" height="200px"> does not work -->
Read more comments on GitHub >

github_iconTop Results From Across the Web

vuetify webpack simple - npm run build - images not being ...
I'm thinking I have to configure the file-loader to fit my project? Of note, I have two images that are being copied to...
Read more >
vue-loader
Start using vue-loader in your project by running `npm i vue-loader`. ... TypeScript icon, indicating that this package has built-in type ...
Read more >
Production Speckle Server deployment - #26 by dimitrie - Help
Just run then npm install && npm run build in the frontend package and let ... node_modules/vuetify/src/components/VCard/VCard.sass despite it was not able ...
Read more >
npm run build - images not being copied to /dist/-vuetify.js
[Solved]-vuetify webpack simple - npm run build - images not being copied to /dist/-vuetify.js. Search. score:0. I replaced the url-loader with file-loader.
Read more >
How to create a Vue.js app using Single-File Components ...
No build or development process is necessary. ... npm install vue vue-loader vue-template-compiler webpack webpack-cli webpack-dev-server ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found