Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Last active August 27, 2018 04:38
Show Gist options
  • Save ThaddeusJiang/0da5f595db6faa21d1847e10143372e3 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/0da5f595db6faa21d1847e10143372e3 to your computer and use it in GitHub Desktop.
[简单] 发布 React Component 到 npm
  1. 创建项目
mkdir component-name && cd $_ 

npx create-react-library
  1. 开发
npm start # runs rollup with watch flag
  1. 编写 Example
# (in another tab)
cd example
npm start # runs create-react-app dev server
  1. publish to NPM
# note this will build `commonjs` and `es`versions of your module to dist/
npm publish
  1. Github Pages
npm run deploy

ref: https://github.com/transitive-bullshit/create-react-library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment