Question · Svelte and SvelteKit course · Module 2: Components

Importing from #lib

How do you import a component from the src/lib directory through the alias in SvelteKit 3?

Answer options

  • import Component from '$lib/Component.svelte'
  • import Component from '#lib/Component.svelte'
  • import { Component } from 'svelte'
  • require('#lib/Component')
Show the answer

Correct answer:

  • import Component from '#lib/Component.svelte'