Skip to content
This repository was archived by the owner on Apr 1, 2023. It is now read-only.
This repository was archived by the owner on Apr 1, 2023. It is now read-only.

FAQ #57

@transitive-bullshit

Description

@transitive-bullshit

How can I use SASS / Less / etc styles in my library?

This is pretty straightforward -- see #56.

Why do you use rollup over webpack?

This is definitely an area of contention, but at the end of the day rollup is much simpler and focused on bundling libraries well whereas webpack tries to do everything and lacks some of the more advanced features of Rollup. For a deeper explanation, I recommend reading Rich Harris’ article Webpack and Rollup: the same but different. In short, a large portion of the community now favors using Rollup for libraries and Webpack for apps.

How can I export multiple components from my library?

Here is a branch which demonstrates how to use multiple named exports. The module in this branch exports two components, Foo and Bar, and shows how to use them from the example app.

What's the preferred way to initialize a React library within a monorepo?

You can use the create-react-library CLI normally within a monorepo to create a package that contains your React component(s). It's up to you whether you create one package that exports N components or N packages that each export one component. create-react-library plays well with Lerna and friends. ✌️

How can I use TypeScript in my library?

Just select the TypeScript template during library initialization via the CLI. Much thanks to @kaltsimon for his work here!

How can I use Flow in my library?

create-react-library doesn't currently have a built-in Flow template. PRs welcome!


Please add any other questions you'd like to see included below. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions