#unbuild how to use aliases

6 messages · Page 1 of 1 (latest)

graceful wagon
#

I am completely lost on how to enable the usage of aliases in unbuild so I can stop doing import {} from '../../../utils and just use '@/utils'. There's like absolute no documentation online on unbuild.

Here's my build.config.ts

import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  entries: [
    { builder: 'mkdist', input: './src', pattern: ['**/*.vue'], loaders: ['vue'] },
    { builder: 'mkdist', input: './src', pattern: ['**/*.{js,ts}'], format: 'esm', loaders: ['js'], ext: 'js' },
    { builder: 'copy', input: './src', pattern: ['**/*.css'] },
  ],
  declaration: true,
  clean: true,
})
short pecanBOT
#

Hi @graceful wagon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'm sorry, but the knowledge sources provided do not contain explicit information about how to enable or configure path aliases (like @/ or ~/) in unbuild. The available documents discuss alias usage and configuration in Nuxt, but do not cover unbuild's support or configuration for aliases.

If you are working within a Nuxt project, aliases are managed via the nuxt.config file and are automatically picked up for TypeScript and runtime usage in your app, but there is no documentation here about extending this to unbuild or configuring unbuild to resolve such aliases during its build process. You may need to consult unbuild's official documentation or repository for more details, or consider using relative paths as a fallback until alias support is clarified.

If you have further questions about Nuxt aliases or their integration in Nuxt projects, feel free to ask!

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@graceful wagon Kapa.ai is still learning and improving, please let me know how I did by reacting below.

graceful wagon
#

bruh

#

documentation so non-existent, LLM can't even hallucinate it