Published on

Using Aliases in SvelteKit

Authors
  • avatar
    Name
    hwahyeon
    Twitter

To use aliases in SvelteKit, you need to add the alias configuration in the kit section of the svelte.config.js file.

const config = {
  kit: {
    alias: {
      $components: 'src/lib/components',
    },
  },
}

With this setup, you can import modules as follows:

import { ComponentA } from '$components'