To create a svelte component package or a web component package
package.json
file change name
of your package (kebab-case string)package.json
file change componentname
value to your own component name (PascalCase string).npm pack
npm i ./path/to/package/
import YourComponentName from 'your-package-name'
npm publish
<svelte:options tag="custom-element" />
tag to your component where custom-element
is the tag name of your web componentrollup.config.js
file set plugins > svelte > compilerOptions > customElement
to true
import 'your-package-name'
<custom-element></custom-element>
tag where custom-element
is the tag name you chose in step 1