Monorepo
The following format is friendly when sharing a webcomponent to NPM using @atomico/exports
βββ src
β βββ define.{js,ts,jsx,tsx}
β βββ elements.{js,ts,jsx,tsx}
β βββ define.test.{js,ts,jsx,tsx}
β βββ slots
β βββ my-sub-element-1.{js,jsx,ts,tsx}
β βββ my-sub-element-2.{js,jsx,ts,tsx}
βββ README.md
βββ index.html
βββ .npmignore
βββ package.json
βββ tsconfig.json
From the previous structure we highlight:
src/define: import the components fromsrc/elementsand declare them as customElementssrc/elements: groups and export components as CustomElements
Why separate the export of the element from the declaration?
since it improves the customElements definition experience, example:
Thanks to @atomico/exports this is really easy, example:
You can see a use case of this structure in @atomico/components
Last updated
Was this helpful?
