nx-extensions icon indicating copy to clipboard operation
nx-extensions copied to clipboard

Library Compilation and HMR

Open MichaelSeelisch opened this issue 3 years ago • 8 comments

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.

MichaelSeelisch avatar Sep 09 '21 14:09 MichaelSeelisch

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.

DominikPieper avatar Sep 10 '21 09:09 DominikPieper

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

MichaelSeelisch avatar Nov 12 '21 14:11 MichaelSeelisch

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.

DominikPieper avatar Nov 12 '21 15:11 DominikPieper

Hey @DominikPieper, thanks for your ultra-fast reply and the hint for generators.

MichaelSeelisch avatar Nov 12 '21 15:11 MichaelSeelisch

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 avatar Jan 05 '22 09:01 Bonscho

@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 avatar Jan 05 '22 10:01 DominikPieper

@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 avatar Jan 10 '22 09:01 Bonscho

@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

DominikPieper avatar Jan 28 '22 14:01 DominikPieper