A shareable Rollup configuration for React components.
Using npm:
npm install --save-dev @nl-design-system/rollup-config-react-component rollup
Using yarn:
yarn add --save-dev @nl-design-system/rollup-config-react-component rollup
Using pnpm:
pnpm add --save-dev @nl-design-system/rollup-config-react-component rollup
In your rollup.config.mjs
, you only need to extend @nl-design-system/rollup-config-react-component
with entry points as follows:
import { config } from '@nl-design-system/rollup-config-react-component';
import { defineConfig } from 'rollup';
export default defineConfig({
input: ['path/to/file', /* more entry points */],
...config;
});
To build a React component, the option "composite"
in a tsconfig.json
's "compilerOptions"
has to be false
. Therefore this configuration explicitly uses a tsconfig.build.json
:
{
"extends": ["./tsconfig.json"],
"compilerOptions": {
"composite": false,
// other build options
},
"exclude": ["**/*.test.ts", "**/*.test.tsx"],
}