publishConfig vs Dev script

In the publishing libraries section

It is recommended to change package.json main/types /… entrypoints from pointing to src/ to dist/ (changing an internal package to be published).

This then also requires the use of a dev script (tsc/tsup + --watch)

Wouldn’t it be simpler to just use the publishConfig section as described in this pnpm guide?

What would be the pros/cons to that approach? (Perhaps using src/ locally vs using the bundled dist/ when the package is published could cause issues?)

Would like to hear opinions and recommendations.

I suppose “simpler” is a matter of preference? Personally, I’d be inclined to argue that using a package inside the monorepo with the same configuration as it will when it gets published.

Both ways work, so it ends up being a matter of preference!

3 Likes