2023-09-30 06:19:02 +02:00
|
|
|
const { nodeResolve } = require('@rollup/plugin-node-resolve');
|
|
|
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
|
|
const typescript = require('@rollup/plugin-typescript');
|
|
|
|
const dts = require('rollup-plugin-dts');
|
|
|
|
const postcss = require('rollup-plugin-postcss');
|
|
|
|
const { terser } = require('rollup-plugin-terser');
|
2022-11-05 20:34:30 +01:00
|
|
|
const peerDepsExternal = require('rollup-plugin-peer-deps-external');
|
2022-11-04 19:12:34 +01:00
|
|
|
|
2023-09-30 06:19:02 +02:00
|
|
|
const packageJson = require('./package.json');
|
2022-11-04 19:12:34 +01:00
|
|
|
|
2022-11-05 20:34:30 +01:00
|
|
|
module.exports = [
|
2022-11-04 19:12:34 +01:00
|
|
|
{
|
2023-09-30 06:19:02 +02:00
|
|
|
input: 'src/index.ts',
|
2022-11-04 19:12:34 +01:00
|
|
|
output: [
|
|
|
|
{
|
|
|
|
file: packageJson.main,
|
2023-09-30 06:19:02 +02:00
|
|
|
format: 'cjs',
|
|
|
|
sourcemap: true
|
2022-11-04 19:12:34 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
file: packageJson.module,
|
2023-09-30 06:19:02 +02:00
|
|
|
format: 'esm',
|
|
|
|
sourcemap: true
|
|
|
|
}
|
2022-11-04 19:12:34 +01:00
|
|
|
],
|
|
|
|
plugins: [
|
2022-11-05 20:34:30 +01:00
|
|
|
postcss({
|
|
|
|
minimize: true,
|
2023-09-30 06:19:02 +02:00
|
|
|
extensions: ['.css'],
|
|
|
|
extract: true
|
2022-11-05 20:34:30 +01:00
|
|
|
}),
|
2022-11-04 19:12:34 +01:00
|
|
|
peerDepsExternal(),
|
2022-11-05 20:34:30 +01:00
|
|
|
nodeResolve({
|
|
|
|
extensions: ['.css']
|
|
|
|
}),
|
2022-11-04 19:12:34 +01:00
|
|
|
commonjs(),
|
2023-09-30 06:19:02 +02:00
|
|
|
typescript({ tsconfig: './tsconfig.json' }),
|
2022-11-05 20:34:30 +01:00
|
|
|
terser()
|
2022-11-04 19:12:34 +01:00
|
|
|
],
|
2023-09-30 06:19:02 +02:00
|
|
|
external: ['react', 'react-dom', 'index.css']
|
2022-11-05 20:34:30 +01:00
|
|
|
},
|
|
|
|
{
|
2023-09-30 06:19:02 +02:00
|
|
|
input: 'dist/esm/index.d.ts',
|
|
|
|
external: [/\.css$/],
|
|
|
|
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
|
|
|
|
plugins: [dts.default()]
|
2022-11-04 19:12:34 +01:00
|
|
|
}
|
2023-09-30 06:19:02 +02:00
|
|
|
];
|