17-publish-component-library 中文文档教程

发布于 5年前 浏览 24 更新于 3年前

Publish Component Library

Base Depenencies

yarn add --dev \
    rollup \
    rollup-plugin-babel \
    rollup-plugin-node-resolve \
    rollup-plugin-commonjs \
    @babel/core \
    @babel/preset-env \
    @babel/preset-react

yarn add --peer \
    react \
    styled-components

Bundle

yarn bundle

通过 Rollup

  • -c, --configUse this config file (if argument is used but value is unspecified, defaults to rollup.config.js)
  • -f, --format: Type of output (amd, cjs, esm, iife, umd)
  • use esm for frontend component library

插件:

Publish

yarn publish

Usage

yarn add react styled-components 17-publish-component-library
import { Spinner } from "17-publish-component-library";

<Spinner />;

演示

Publish Component Library

Base Depenencies

yarn add --dev \
    rollup \
    rollup-plugin-babel \
    rollup-plugin-node-resolve \
    rollup-plugin-commonjs \
    @babel/core \
    @babel/preset-env \
    @babel/preset-react

yarn add --peer \
    react \
    styled-components

Bundle

yarn bundle

By Rollup

  • -c, --configUse this config file (if argument is used but value is unspecified, defaults to rollup.config.js)
  • -f, --format: Type of output (amd, cjs, esm, iife, umd)
  • use esm for frontend component library

Plugins:

Publish

yarn publish

Usage

yarn add react styled-components 17-publish-component-library
import { Spinner } from "17-publish-component-library";

<Spinner />;

Demo

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文