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.

Image assets imported relatively in components are not processed properly

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v14.18.1
  • Nuxt Version: 3.0.0-27386759.b449d0b
  • Package Manager: yarn@1.22.17
  • Bundler: Vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://codesandbox.io/s/prod-cdn-2g32p

Describe the bug

I am trying to put the image assets in the components path (next to the .vue component files) and try to use them by a relative path like <img src="./play.svg" />, the assets are not loaded properly in nuxi build, though they work well in nuxi dev.

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
baronkokocommented, Jun 20, 2022

Any updates on this one?

2reactions
danielroecommented, Aug 18, 2022

I can’t reproduce this now on RC8 - I believe the Vite 2 -> 3 upgrade has resolved this issue. If not, please provide a reproduction and I’ll look into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Images not loading from assets folder in Angular
Angular resolves this problem for you, and in a component, you have to only add a path to the assets folder, instead of...
Read more >
image assets not loading on github:pages after prod deploy
As of Dec 30 2016 it is not possible to have images inside the component and reference them using local relative paths. See...
Read more >
App Handling Assets | Quasar Framework
You will notice in the project structure we have two directories for assets: /public/ and /src/assets/ . What is the difference between them?...
Read more >
HTML and Static Assets - Vue CLI
Static assets can be handled in two different ways: Imported in JavaScript or referenced in templates/CSS via relative paths. Such references ...
Read more >
Assets directory - Nuxt
If you use url('~assets/image.png') in your CSS, it will be translated into require('~/assets/image.png') .
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