R
R
ravshan selimov2021-09-22 09:39:01
JavaScript
ravshan selimov, 2021-09-22 09:39:01

Correct loading of images in nuxt.js does not work with dynamic path substitution?

Hello.
Project on vue + nuxt.js

There is a component

<template lang="pug">
  .vn-image
    .vn-image-loader(v-if="loading")
    img(:src="require(src)" :alt="alt" @load="loading = false")
</template>


I insert src as in the docks
But it still does not work
Cannot find module '~/assets/images/team/aleksandr.png'

webpack:/components/uiElements/vnImage sync:2:  webpackEmptyContext


What can be done?
Do you have to reconfigure webpack or something like that?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question