Turborepo: Install local package the same way NPM would (dist/)

131 Views Asked by At

I'm working on testing my component library in the same way it is consumed by other projects. Meaning, I need to be pulling the same assets I would publish to NPM.

By default, Turborepo creates a symlink to the source code of a local project. Unfortunately, this isn't how consuming projects access the code.

Is there any way to do this with Turborepo or do I need something custom?

1

There are 1 best solutions below

0
On

You must first compile your packages using rollup or tsup, then use npm link, and finally, test it in an external project using npm link your-package.

https://turbo.build/repo/docs/handbook/publishing-packages/bundling

If you can compile all the packages, you can try using scripts similar to chakra-ui.

https://github.com/chakra-ui/chakra-ui/tree/main/scripts/build

npm-link https://docs.npmjs.com/cli/v10/commands/npm-link