Skip to content

Commit 1b1d226

Browse files
easier peerdeps handling; add material-ui example and multiple exports examples to readme
1 parent 2f006df commit 1b1d226

File tree

5 files changed

+394
-212
lines changed

5 files changed

+394
-212
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ Now, anytime you make a change to your component in `src/` or to the example app
8080

8181
#### NPM Stuffs
8282

83-
The only difference when publishing your component to **npm** is to make sure you add any npm modules you want as peer dependencies to the `external` array in `rollup.config.js`. Then publish as per usual.
83+
The only difference when publishing your component to **npm** is to make sure you add any npm modules you want as peer dependencies are properly marked as `peerDependencies` in `package.json`. The rollup config will automatically recognize them as peer dependencies and not try to bundle them in your module.
84+
85+
Then publish as per usual.
8486

8587
```bash
8688
# note this will build `commonjs` and `es`versions of your module to dist/
@@ -97,10 +99,18 @@ npm run deploy
9799

98100
Note that it's important for your `example/package.json` to have the correct `homepage` property set, as `create-react-app` uses this value as a prefix for resolving static asset URLs.
99101

100-
## Example Module
102+
## Examples
101103

102104
Here is an example react module created from this guide: [react-background-slideshow](https://github.com/transitive-bullshit/react-background-slideshow), a sexy tiled background slideshow for React. It comes with an example create-react-app hosted on github pages and should give you a good idea of the type of module you’ll be able to create starting from this boilerplate.
103105

106+
### Multiple Named Exports
107+
108+
Here is a [branch](https://github.com/transitive-bullshit/react-modern-library-boilerplate/tree/feature/multiple-exports) which demonstrates how to create a module with multiple named exports. The module in this branch exports two components, `Foo` and `Bar`, and shows how to use them from the example app.
109+
110+
### Material-UI
111+
112+
Here is a [branch](https://github.com/transitive-bullshit/react-modern-library-boilerplate/tree/feature/material-ui) which demonstrates how to create a module that makes use of a relatively complicated peer dependency, [material-ui](https://github.com/mui-org/material-ui). It shows the power of [rollup-plugin-peer-deps-external](https://www.npmjs.com/package/rollup-plugin-peer-deps-external) which makes it a breeze to create reusable modules that include complicated material-ui subcomponents without having them bundled as a part of your module.
113+
104114
## License
105115

106116
MIT © [Travis Fischer](https://github.com/transitive-bullshit)

0 commit comments

Comments
 (0)