> For the complete documentation index, see [llms.txt](https://freeseamew.gitbook.io/svelte/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://freeseamew.gitbook.io/svelte/10-./untitled.md).

# 경로 쉽게 적용하기

아래와 같은 `../`로 계속해서 내려가야 하는 경우가 있을 수 있다.

import Component from "../../../../components/Component.svelte";

이럴때 도움을 줄 수 있는 플러그인이 `plugin-alias` 이다.

* 설치

```
npx add -D @rollup/plugin-alias
```

* 설정

```
// rollup.config.js
import alias from '@rollup/plugin-alias';

const aliases = alias({
  resolve: ['.svelte', '.js'], //optional, by default this will just look for .js files or folders
  entries: [
    { find: 'components', replacement: 'src/components' },
    { find: '@', replacement: 'src' }
  ]
});

...

export default {
  ...
  plugins: [
    aliases,
		...
  ]
  ...
}
```

* 사용

```
import Component from 'components/Component.svelte'
...

```

[\[만들면서 배우는 Svelte\]](https://www.inflearn.com/course/%EB%A7%8C%EB%93%A4%EB%A9%B4%EC%84%9C-%EB%B0%B0%EC%9A%B0%EB%8A%94-%EC%8A%A4%EB%B2%A8%ED%8A%B8)

<div align="left"><img src="/files/-MGqwZuQK1aEaE5Bp21i" alt="만들면서 배우는 svelte"></div>
