This is a tsmodule
component library
developed and previewed with Next.js.
To start the Next server and develop your components, use next dev
or the
yarn dev
script:
yarn dev
# calls `next dev`
To export your component library, use tsmodule build
or the yarn export
script:
yarn export
# calls `tsmodule build`
You can then publish to NPM:
yarn publish
To reuse your components:
- Import your component styles via
import "my-library/styles"
. - Import your component and render it via
import { MyComponent } from "my-library/MyComponent
.
Styles are exported in dist/
, and are also bundled to dist/bundle.css
from
the entrypoint given in the style
package.json.
The default behavior is to export all component styles, i.e.
src/styles/components/index.css ➞ dist/bundle.css
. This can be overridden
with tsmodule's --styles
flag, i.e. tsmodule build --styles src/styles/index.css
(which would include all styles in emitted bundle).