nx-extensions
nx-extensions copied to clipboard
Library Compilation and HMR
A stencil ui component library isn't compiling automatically when nx workspace serve
listens for changes, like it would happen for a react library. Compilation process has to be triggered manually for stencil components. Only changes in apps are recognized by the watch task.
Hi @MichaelSeelisch Yes, that's correct and not possible that easy. There was a meeting with William from the Stencil team on how to solve this, but that's a feature for later.
Hey @DominikPieper, thanks a lot for the fast reply.
Now i have another question:
Is it possible to change the templates used by the generators? I made several changes in the templates for app and component, but i had to change the files in the node_modules folder. Of course all my changes would be lost in case of package update and it would be a much cleaner solution if i could reference custom templates to the generator as parameter in the CLI, f. e.
nx g @nxext/stencil:app myApp --template=pathToMyCustomTemplate
Hi @MichaelSeelisch, There's no feature to give in custom Templates. You can add workspace generators (https://nx.dev/l/a/generators/workspace-generators) to your workspace, call the generators you've in mind, and override the templates there.
Hey @DominikPieper, thanks for your ultra-fast reply and the hint for generators.
Hi @MichaelSeelisch Yes, that's correct and not possible that easy. There was a meeting with William from the Stencil team on how to solve this, but that's a feature for later.
Any news on this? Not being able to change a library and directly have the changes in an app that consumes the library without rebuilding both – library and app – is neither fail safe nor comfortable.
Maybe someone can provide some kind of workaround?
@Bonscho unfortunately not yet. Not sure when and how it's planned by the new Stencil team. I experiment with some stuff myself but everything else is just a workaround until it's natively supported and I'm not sure how easy it is to create it from external
@DominikPieper sad to read. If we can support this topic with some real world experience, please let us (@MichaelSeelisch and me) know. Would be great to make nx work with (nested) stencil libraries.
@Bonscho all I tried so far lead into a reload off all (at least the lib and app) cause what's the app serve process sees is that the lib was rebuilt. The stencil compiler unfortunately isn't able to do hmr with dependent libs/components. There's a branch from a community member but nothing ready to use yet