Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for building individual packages #436

Open
mattpocock opened this issue Dec 11, 2021 · 6 comments
Open

Allow for building individual packages #436

mattpocock opened this issue Dec 11, 2021 · 6 comments

Comments

@mattpocock
Copy link

For instance, preconstruct build <package-name>.

My use case is that with turborepo, you can cache the result of individual package builds. This means you can rebuild only what changed. With preconstruct, I currently need to rebuild everything all at once, which is inefficient.

@Andarist
Copy link
Member

Could you tell me a little bit more about how it behaves right now for you? I've taken a quick look and it seems that if you invoke preconstruct from non-root directory then it will "focus" on that directory but won't be able to resolve the root options, Babel config, and stuff like that. This is because there is no directory lookup to search for the "monorepo root" and the cwd is just treated as the root in such a scenario.

Would that somewhat match what you have experienced?

@liorheber
Copy link

Hi,

Sorry for reviving an old open issue.
We've been using running preconstruct inside the individual workspaces and for the most part it's been working great.
One thing that has been happening inconsistently during the build command is that it will overwrite the code entry point (e.g. index.js) with the content of the build.
It's been inconsistent, so I'm not sure exactly how to provide steps to reproduce.

@Andarist
Copy link
Member

I'm afraid that without having a repro case for this it might be super hard to fix this. It would even be good enough - to start the investigation - if a sample repo could be provided with a script that would just loop until it fails to build the thing correctly. The point is to prove that it can fail and to have some way of reproducing it - even if it's not as simple as calling preconstruct build in a given repo.

@jrolfs
Copy link
Contributor

jrolfs commented Feb 9, 2023

@Andarist this is exactly what I ran into in trying to accomplish this with Preconstruct's current preconstruct build implementation:

I've taken a quick look and it seems that if you invoke preconstruct from non-root directory then it will "focus" on that directory but won't be able to resolve the root options, Babel config, and stuff like that. This is because there is no directory lookup to search for the "monorepo root" and the cwd is just treated as the root in such a scenario.

@jrolfs
Copy link
Contributor

jrolfs commented Feb 23, 2023

@Andarist would y'all be open to a pull request for this? I'd be happy to give it a go if so.

@Andarist
Copy link
Member

@jrolfs I think so. I'm not overly familiar with this codebase but I don't see any particular major blockers for this feature. Maybe there is some nuance in the .d.ts emits there, but even that shouldn't really depend on other packages since the output doesn't include anything from those other packages - just imports to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants