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.

CImage not working in Nuxt project. Src not showing in image.

See original GitHub issue

I have a working Vue project that I am trying to convert over to using Nuxt. In the navbar of the site I have an image for a logo, this logo shows properly in the Vue project but not in the Nuxt project. After following both the suggested methods for handling images in the Chakra UI Vue docs as well as in the Nuxt docs I cannot get the image to show in the Nuxt project. When inspecting the image element I can see that the src attribute is never added. I also see this behavior with images on the Chakra UI Vue website where the image used in the examples do not appear and do not have a src attribute. I am not sure if this is an error on my part or an issue with Chakra but any help would be appreciated.

  • Mac OS Catalina 10.15.7
  • Webstorm 2021.1
  • @nuxt/cli v2.15.6

Nuxt layout default.vue

<template>
    <CThemeProvider>
      <CColorModeProvider>
        <CBox font-family="body" as="main">
          <CReset/>
          <CFlex>
            <CLink href="#" w="100%">
              <CImage
                :src="require('@/assets/runic-logo.svg')"
                alt="runic logo"
                :width="['15%', '50%', '7%', '8%', '3%']"
                v-anime="{
            opacity: [0, 1],
            duration: 1500,
            delay: 300,
          }"
              />
            </CLink>
            <Nav/>
          </CFlex>
          <Nuxt/>
        </CBox>
      </CColorModeProvider>
    </CThemeProvider>
</template>

nuxt.config

import customTheme from './assets/customTheme.js'

export default {
  // Target: https://go.nuxtjs.dev/config-target
  target: 'static',

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'nuxt-portfolio',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    '~/assets/scss/styles.scss'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '~/plugins/anime.js'
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: {
    dirs: [
      '~components',
      '~/components/about',
      '~/components/home',
      '~/components/nav',
      '~/components/skills',
    ],
  },

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/chakra
    '@chakra-ui/nuxt',
    // https://go.nuxtjs.dev/emotion
    '@nuxtjs/emotion',
  ],

  chakra: {
    extendTheme: customTheme
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
  }
}

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
DRD161commented, Jun 14, 2021

@peoray awesome! Thanks for the quick fix! Keep up the great work guys!

1reaction
peoraycommented, Jun 14, 2021

@DRD161 The issue has been fixed. All you have to do is update Chakra to the latest version

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue NuxtJS custom image tag not loading my src
Create a folder called images inside the static directory and move your images into it, then use them as follows :
Read more >
Nuxt Generate does not produce images · Issue #215 - GitHub
I have tried with a fresh Nuxt project with only @nuxt/image added and get exactly the same issue. Running nuxt generate produces no...
Read more >
nuxt-img
Converts src to provider optimized URLs; Automatically resizes images based on width and height; Generates responsive sizes when providing sizes option ...
Read more >
Chapter 1. Basic Image Handling and Processing - O'Reilly
This chapter is an introduction to handling and processing images. With extensive examples, it explains the central Python packages you will need for ......
Read more >
Copyright Fair Use and How it Works for Online Images
Distribute copies of the copyrighted work to the public by sale, rental or lending, and/or to display the image. Source: 17 USC Section...
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