-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.ts
28 lines (21 loc) · 942 Bytes
/
rollup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import typescript from '@rollup/plugin-typescript';
import { readFileSync } from 'fs';
import type { RollupOptions } from 'rollup';
import dts from 'rollup-plugin-dts';
import postcss from 'rollup-plugin-postcss';
const pkg = JSON.parse(readFileSync('./package.json') as unknown as string);
const input = 'src/LiveIsland.tsx';
const cjsOutput = { file: pkg.main, format: 'cjs', exports: 'auto' } as const;
const esmOutput = { file: pkg.module, format: 'es' } as const;
const dtsOutput = { file: pkg.types, format: 'es' } as const;
const plugins = [typescript(), postcss({ minimize: true })];
const external = [
...Object.keys({ ...pkg.dependencies, ...pkg.peerDependencies }),
/^react($|\/)/,
];
const config: RollupOptions[] = [
{ input, output: cjsOutput, plugins, external },
{ input, output: esmOutput, plugins, external },
{ input, output: dtsOutput, plugins: [dts()], external: [/\.scss$/] },
];
export default config;