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

serve or build in --watch mode does not watch dependent libraries also #20

Closed
simondotm opened this issue May 23, 2021 · 7 comments
Closed
Labels
enhancement New feature or request

Comments

@simondotm
Copy link
Owner

Scenario:
Functions project depends on node-library
Run build --with-deps --watch
Changes to dependencies and/or main application code result in inconsistent rebuilds

Look into nx-watch plugin to resolve this
https://gist.github.com/jhesgodi/2d530753c551ace665a8c3010d3a719c

@simondotm simondotm added the enhancement New feature or request label May 23, 2021
@simondotm
Copy link
Owner Author

Theres a rumour this used to work on Nx v11.x , but I cant find the github issue I spotted with this info in it

@simondotm
Copy link
Owner Author

It's Nx issue 5762

@KingDarBoja
Copy link

It's Nx issue 5762

Copying the issue so the related fix can be tracked: nrwl/nx#5762

@simondotm
Copy link
Owner Author

Recent Nx changes offer some new possibilities here, observer on the tsc process could be just the ticket
Dropping here for reference
AgentEnder/nx@c95f246

@IdanCo
Copy link

IdanCo commented Jul 17, 2021

Great project!!!

I've solved this issue outside nx by building the library INTO the functions folder. Not sure this strategy would work in this case. I see you're copying the built library only once. Any chance to update it on every change as well?

I wrote my recipe for the non-nx solution, hope it could be of use. Let me know If I can get involved somehow. Auto-refreshing the firebase functions is a dream of mine.

@simondotm
Copy link
Owner Author

simondotm commented Jul 20, 2021

Thanks for sharing your approach, and yes, I'd love to get this working somehow.

Building libraries directly into the functions folder is a neat idea but doesn't feel quite right as a solution for Nx workspaces since we cant always be sure a given buildable library won't be a dependency of multiple apps in the workspace.

Generally seems like we'll need to somehow figure out how an nx plugin can watch specific folders or dependencies (we do know all of the target libraries that a functions application depends on, so thats a good start) and then run its own logic (copying the updated lib outputs in our case) whenever there's a change detected.

Reading the comments in various Nx threads though atm, I get the feeling this functionality exists but is a little bit fragile - keeps working, then not working across recent releases. I'm tempted to see how Nx team resolve some of these features, and then we can follow their examples.

I'm always open to ideas though!

@simondotm
Copy link
Owner Author

See #95

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

No branches or pull requests

3 participants