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

How to watch dependencies in Classic and Embroider #2129

Open
simonihmig opened this issue Oct 1, 2024 · 2 comments
Open

How to watch dependencies in Classic and Embroider #2129

simonihmig opened this issue Oct 1, 2024 · 2 comments

Comments

@simonihmig
Copy link
Collaborator

This issue is for documenting how the different Ember build systems behave regarding watching the different types of dependencies, and potentially addressing any gaps.

Classic/eai Embroider/Webpack (stable) Embroider/Vite (main) Embroider/Webpack (future IoC)
v1 addon just works 1 just works 1 ? ?
v2 addon needs watchDependencies needs broccoli-side-watch 2 just works ?
npm pkg needs watchDependencies needs broccoli-side-watch 2 just works ?

Footnotes

  1. Used to need enabling isDevelopingAddon, but seems this enabled by default when canNestRoots is true (source) 2

  2. https://github.com/embroider-build/embroider/issues/1892 2

@ef4
Copy link
Contributor

ef4 commented Oct 1, 2024

Embroider/Vite (main) v1 Addon should work as long as we're using BROCCOLI_ENABLED_MEMOIZE the same way stable does, we should confirm that.

Embroider/Webpack (future IoC) will just work.

v2 addon and npm under both Classic/eai and Embroider/Webpack (stable) could be made to work if we start integrating Webpack's watch mode inside the broccoli pipeline.

@simonihmig
Copy link
Collaborator Author

v2 addon and npm under both Classic/eai and Embroider/Webpack (stable) could be made to work if we start integrating Webpack's watch mode inside the broccoli pipeline.

@ef4 Have looked into that a bit, but failed to figure out how this can be done. Like when we hook into webpack's watch mode, we would need to make the broccoli tree that is wrapping the webpack build understand that something changed so that it rebuilds, right? But AFAICT how broccoli's watch mode works is that you mark specific input nodes as being watched (WatchedDir), but the files changing that webpack is notifying us about are always outside of what is the broccoli input. So we basically need to tell broccoli that some files changed that are not covered by any input nodes, but it needs to rebuild anyway. But I don't see an API that would allow us to that? Or do I misunderstand?

Anyways, in the meantime I worked on #2141, which should make broccoli-side-watch work as easy as watchDependencies, so both APIs are at par. And maybe "good enough" to make the above mentioned approach not being worth the effort, given that next-gen Embroider will just work already!?

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

2 participants