Closed oxyc closed 4 years ago
Trying to get the components distributed as individual packages is something we could skip for now though. I would think it should be technically possible to add it at a later stage once we've actually learned to use Stencil.
Going with something like #2, would be following along the Stencil docs and the most common use case where all components are distributed in a single package. To get started quickly I vote committing to stencil with all it's features (build processes included), and then figuring out how we can get versioned components later.
I looked into this some more and it seems it could eventually even be supported (might it be the currently disabled dist-custom-elements
?
If not, it's possible to add your own output targets as a plugin. This seems flexible enough to do pretty much everything.
Tricky questions. I support going with Stencil.
So there's an issue with using stencil together with Lerna. Using stencil and profiting from lazy-loading etc, we'd really need to define it in the root package. Meaning
npm run build
runs thestencil
build processes directly and consumer projects would then import components like with some stencil version of the pseudo code:The issue is that the build output would also go to the root of the project and even if we changed the
packages/
folder for lerna to match that of stencil components I don't see a way for distributing standalone packages for each component.I see two options:
We add some post-build task that copies (and compiles if necessary) individual components into the packages before lerna publishes them. I guess this should be possible and for overriding an individual component (or just importing a single component) would be something like:
where the button wont support any lazy loading techniques but should already be prebuilt and not dependent on any globals. My main concern is that I haven't seen anyone doing this? Could any issues come up? https://github.com/ionic-team/stencil/issues/2206 should keep digging here
We bundle stencil with each individual component that uses it. And run
lerna run build
in the root to build all the components individually and standalone. This makes it impossible to profit from lazy-loading and probably bundle sizes gets larger. Also the build time sounds scary and in general not the way to go.