---
title: "Comment by Rob Levin on \"Creating a React Component Library with TypeScript, Storybook & Rollup\" | Hashnode"
description: "Thanks for the guide Cristiana! I just went through this dance myself and here are some additional things I found interesting: Use npm pack to test out what&#39"
url: "https://hashnode.com/posts/creating-a-react-component-library-with-typescript-storybook-and-rollup/60737b5a1494367be6d2b56f/comment/615530dd414f78089df3dcd1"
---

[Discussion](https://hashnode.com/posts/creating-a-react-component-library-with-typescript-storybook-and-rollup/60737b5a1494367be6d2b56f)

Comment [Creating a React Component Library with TypeScript, Storybook & Rollup](https://hashnode.com/posts/creating-a-react-component-library-with-typescript-storybook-and-rollup/60737b5a1494367be6d2b56f)

[Rob Levin](https://hashnode.com/@agnosticui-guy)

[Sep 30, 2021](https://hashnode.com/posts/creating-a-react-component-library-with-typescript-storybook-and-rollup/60737b5a1494367be6d2b56f/comment/615530dd414f78089df3dcd1)

Thanks for the guide Cristiana! I just went through this dance myself and here are some additional things I found interesting:

-   Use `npm pack` to test out what's getting placed in your published package. Also, it lets you `npm i path/to/tarbal-0-0-0.tgz` to verify. Much more reliable then pure npm linking on both sides.

-   I had to do

```
    typescript({
      declaration: true,
    }),
```

and in my tsconfig

```
    "noEmit": false,
    "emitDeclarationOnly": true,
```

and then use `tsc` to build the types with:

```
    "build:types": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
```

where my `tsconfig-cjs.json` extended the main one just changing the `module` to `CommonJS` and `outDir` to `dist/cjs`. It seems `dist` is most popular default e.g. for create-react-app aka `react-scripts` it seems to "want" stuff in `dist` (I had put stuff in `lib` before).

It's probably worth experimenting with the `postcss` options:

```
    postcss({
      minimize: true,
      sourceMap: true,
      extract: true,
    }),
```

I wanted my css minimized and not inlined. I thought I'd need to add `module: true` but there's a default in `postcss` that if you already name your files `foo.module.css` it'll treat it as a CSS module anyway (of course this is only for folks who care about that).

All this was done for my [AgnosticUI React](https://github.com/AgnosticUI/agnosticui/tree/master/agnosticui-react) package (but similar for Vue and Svelte packages too)

I definitely took a lot of tweaking and I referenced many other blog articles and docs before getting it to my liking. Thanks again for yours Cristiana!
