Image assets imported relatively in components are not processed properly
See original GitHub issueEnvironment
- 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:
- Created 2 years ago
- Reactions:7
- Comments:30 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any updates on this one?
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.