使用单个 stenciljs 项目的独立 Web 组件
Independent web components using single stenciljs project
是否可以设置一个 StencilJS 项目,使多个 Web 组件相互独立?
目前我可以看到有2个种子项目可以分别用于开发组件和应用程序。
我有一个用例,我们希望在一个地方管理所有组件。我们想要 generate/build 独立的组件脚本,但不希望每个组件有多个 package.json 和构建过程。
通常的做法是让一个存储库包含许多子目录,每个子目录都有一个组件。每个组件都有完整的构建过程,package.json
但 lerna 用于 运行 一个命令一次 build/test/publish 所有组件。
最新版本的 StencilJS 支持组件特定的包:
Custom Elements Bundle。
您可以配置 stencil.config.ts
以生成此类捆绑包以及组合捆绑包。
请注意:
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
是否可以设置一个 StencilJS 项目,使多个 Web 组件相互独立?
目前我可以看到有2个种子项目可以分别用于开发组件和应用程序。
我有一个用例,我们希望在一个地方管理所有组件。我们想要 generate/build 独立的组件脚本,但不希望每个组件有多个 package.json 和构建过程。
通常的做法是让一个存储库包含许多子目录,每个子目录都有一个组件。每个组件都有完整的构建过程,package.json
但 lerna 用于 运行 一个命令一次 build/test/publish 所有组件。
最新版本的 StencilJS 支持组件特定的包:
Custom Elements Bundle。
您可以配置 stencil.config.ts
以生成此类捆绑包以及组合捆绑包。
请注意:
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