nuxt / nuxt/image

Alias not supported

Open
#352 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v0
Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

If I use alias for images folder, it does not work.

https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-alias

nuxt.config.js:

import { resolve } from 'path'
export default {
  alias: {
    'myimages': resolve(__dirname, './assets/images'),
  }
}

pages/index.vue:

<template>
   <div>
       <!-- it works -->
       <img src="~myimages/pic.jpg >

       <!-- it fails -->
       <nuxt-img src="~myimages/pic.jpg >
   </div>
</template>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the alias configuration in nuxt.config.js and compare how the working and failing examples in pages/index.vue resolve ~myimages/pic.jpg. Check the linked Nuxt alias documentation first; done means the alias works with as it does with , with coverage added if the existing project tests provide a relevant entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.