Skip to content

A file imports from inside another package

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.

axle boundaries 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.

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 rather than a package, there’s no name to import it by, and the hint says so:

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.