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.

Assets with dynamic names are not resolved

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.8
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-pq8nym?file=app.vue

Describe the bug

If you have an image referencing a dynamic asset, e.g.

<template>
  <img :src="`~/assets/${dynamic_image_name}`" alt="Discover Nuxt 3" />
</template>
<script setup lang="ts">
const dynamic_image_name = 'zero-config.svg';
</script>

then this is rendered as

<img src="~/assets/zero-config.svg" alt="Discover Nuxt 3">

without correctly resolving (and copying) the image, thus it doesn’t show in the browser.

Additional context

Refs https://github.com/nuxt/framework/pull/6635.

Logs

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:11
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

13reactions
mattyleggycommented, Sep 24, 2022

Is this the only way to get dynamic images in Nuxt 3? Was super easy in Nuxt 2 with require.

9reactions
wangrongdingcommented, Nov 10, 2022

Wait for the official to provide a better solution.😅😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js dynamic images not working - Stack Overflow
js with webpack web app, I need to display dynamic images. I want to show img where file name of images are stored...
Read more >
Dynamic Group not removing assets who fail to meet criteria
Solved : I have the latest version of Lansweeper. I created a dynamic group with three filter criteria: State Equal To Active Software...
Read more >
Dynamic Asset Definition Rules in SC 5.1
Good Morning, I'm trying to create some Dynamic Assets within Security Center 5.1. I've been trying to add the following rules within the ......
Read more >
Troubleshooting Dynamic Media - Scene7 mode
Check asset jcr:content > dam:assetState = if unprocessed it was not picked up by the workflow. Wait until asset is picked up by...
Read more >
Dynamic tag based on list of specific host/asset names?
If one is not found, then perhaps try to tag based on an IP address next. Currently I am assigning static tags manually...
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