This project can be used to create your next React Component library. It's configured to give you a starting place for publishing react components to NPM.
yarn
ornpm install
if you're old fashioned- Develop components within the
src
directory. Make sure to export the ones you want in your library fromsrc/index.js
- Set your libraries name within the root level webpack configuration file's output object and in the package.json.
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
library: 'react-library-starter', // your library's name goes here
libraryTarget: 'umd',
umdNamedDefine: true,
},
- Increment the version of your package with
npm version x.x.x
- Run
npm publish
with your code checked into to git and watch as your npm library is born!
It's often the case that you want to test your components out with an example app before publishing.
Included in this setup is a setup to do just that.
cd example/app && yarn
- Within the example/app directory, you will find a setup that you can use to test your app. Import your components from
components
and use them within the App.js file. - Run
npm run start
and navigate tohttp://localhost:3000 to see your app