-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
38 lines (35 loc) · 916 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
29
30
31
32
33
34
35
36
37
38
import { createRequire } from 'node:module'
import { defineConfig } from 'rollup'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import ts from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'
import rm from './src'
const require = createRequire(import.meta.url)
const pkg = require('./package.json')
export default defineConfig([
{
input: 'src/index.ts',
output: [
{ file: pkg.main, format: 'cjs' },
{ file: pkg.module, format: 'es' }
],
plugins: [
rm('dist', 'buildStart'),
resolve(),
commonjs(),
ts({
compilerOptions: {
rootDir: 'src',
declaration: true,
outDir: 'dist/types'
}
})
]
},
{
input: 'dist/types/index.d.ts',
output: [{ file: pkg.types, format: 'es' }],
plugins: [dts(), rm('dist/types', 'buildEnd')]
}
])