1

I am working on a components library (such as material-ui). I am using rollup for compiling. For the moment I can generate a single package, and to import a component such as a button, I can do it like that :

import { Button } from "package-name";

Can I modify the rollup configuration to generate a separate package or chunk for each component. In other word, can I split the big-size package in separate small-size packages (one for each component) and use them in a way similar to this:

import { Button } from "package-name/Button";

I start looking to the Code Splitting... But I am wandring if there is a known best practice to have this result?

Is there a specific way to write the rollup.config file ?

Ramzi B.
  • 31
  • 2

0 Answers0