# A file imports from inside another package

What "imports …, which is inside" another package means and how to fix it.

```text
error: apps/web/src/app.tsx:2 imports ../../../packages/ui/src/button, which is inside ui
hint: Import it by the package's name, ui, and declare it as a dependency, so its package.json and exports apply.
```

## Why it happens

[`axle boundaries`](https://axlers.dev/docs/reference/boundaries.md) found a relative import that leaves the file's package and reaches into another package's folder. It skips that package's `package.json`: its `exports`, its build, and the dependency Axle and the package manager would know about.

## How to fix it

Import what you need by the package's name, such as `import { Button } from 'ui'`, add the package to the importing package's dependencies, and export it from the package if it isn't yet. If the two folders are really one package, move the code so they share a `package.json`.

When either side is a [project](https://axlers.dev/docs/reference/configuration.md#projects) rather than a package, there's no name to import it by, and the hint says so:

```text
hint: Move what web needs from scripts into a package both can depend on, and import it by that package's name.
```

Move the shared code into a package both can depend on.
