Search code examples
angularionic-frameworkweb-componentstenciljs

Independent web components using single stenciljs project


Is it possible to setup a single StencilJS project that can have multiple web components independent of each other?

As of now I can see there are 2 seed projects that can be used for developing component and app respectively.

I have a use case where we want to manage all our components at single place. We want to generate/build independent component scripts but don't want to have multiple package.json and build process for each component.


Solution

  • Latest version of StencilJS supports component specific bundles: Custom Elements Bundle. You can configure stencil.config.ts to generate this kind of bundles along with combined bundles.

    Please Note:

    you will still be shipping all components into a single npm module, but your consumers will now have a choice to register only components of their interest.

    If you wish to have separate node modules using single source code repo, you should setup a monorepo using Lerna or yarn 2 workspaces