1.0.2 • Published 7 months ago

@nl-design-system/rollup-config-react-component v1.0.2

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
7 months ago

@nl-design-system/rollup-config-react-component

A shareable Rollup configuration for React components.

Installation

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

Usage

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"],
}