Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
Failed to load the image in vue component published to codeArtifact

I made vue component to display just an image.

I've done npm build:lib and npm publish it. However, it couldn't load the image, but the mark like this picture

Also, I found that path inside src attribute was not identical with node_modules/icon-test/dist folder's structure in the project where I installed the component.

<img data-v-43101371="" alt="cat" src="http://localhost:8081/js/73b12abfb4c55c5d8c687fd31d469762.jpg">

I've been stuck with this issue several days. I'd appreciate if anyone provide some information.

My component files are below:

component file structure

components/CatImage.vue:

<template>
  <div class="hello">
    <img alt="cat" :src="showCat" />
  </div>
</template>

<script lang="ts">
import { Vue } from "vue-property-decorator";

export default class CatImage extends Vue {
  private showCat: string = require("@/assets/img/cat.jpg");
}
</script>

views/Home.vue

<template>
  <div class="home">
    <CatImage />
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import CatImage from "@/components/CatImage.vue";

@Component({
  components: {
    CatImage,
  },
})
export default class Home extends Vue {}
</script>

vue.config.js

module.exports = {
  chainWebpack: (config) => {
    config.module
      .rule("images")
      .test(/\.(png|jpg|jpe?g|gif|webp)(\?.*)?$/)
      .use("file-loader")
      .loader("file-loader")
      .options({
        name: "[name].[ext]",
        outputPath: "assets/img/",
      })
      .end();
    config.module.rule("images").use("url-loader").loader("file-loader");
  },
};

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda