2022-08-01 20:06:14 +10:00
|
|
|
import { babel } from '@rollup/plugin-babel'
|
|
|
|
|
import commonjs from '@rollup/plugin-commonjs'
|
|
|
|
|
import json from '@rollup/plugin-json'
|
|
|
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
|
|
|
|
import { terser } from 'rollup-plugin-terser'
|
|
|
|
|
import pkg from './package.json'
|
2022-08-01 14:27:11 +10:00
|
|
|
|
2022-08-01 20:06:14 +10:00
|
|
|
const extensions = ['.js', '.ts']
|
2022-08-01 14:27:11 +10:00
|
|
|
|
2022-08-01 20:06:14 +10:00
|
|
|
const plugins = [
|
|
|
|
|
json(),
|
|
|
|
|
nodeResolve({ extensions }),
|
|
|
|
|
commonjs(),
|
|
|
|
|
babel({
|
|
|
|
|
extensions,
|
|
|
|
|
}),
|
|
|
|
|
terser(),
|
|
|
|
|
]
|
2022-08-01 14:27:11 +10:00
|
|
|
|
2022-08-01 20:06:14 +10:00
|
|
|
export default [
|
|
|
|
|
{
|
|
|
|
|
input: 'src/index.ts',
|
|
|
|
|
external: [
|
|
|
|
|
Object.keys(pkg.dependencies || {}),
|
|
|
|
|
Object.keys(pkg.peerDependencies || {}),
|
|
|
|
|
].flat(),
|
|
|
|
|
output: [
|
|
|
|
|
{
|
|
|
|
|
file: pkg.module,
|
|
|
|
|
format: 'esm',
|
2022-08-01 14:27:11 +10:00
|
|
|
},
|
2022-08-01 20:06:14 +10:00
|
|
|
{
|
|
|
|
|
file: pkg.main,
|
|
|
|
|
format: 'cjs',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
plugins,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
input: 'src/index.ts',
|
|
|
|
|
output: [
|
|
|
|
|
{
|
|
|
|
|
name: pkg.name,
|
|
|
|
|
file: pkg.browser,
|
|
|
|
|
format: 'umd',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
plugins,
|
|
|
|
|
},
|
|
|
|
|
]
|