-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
rollup.config.js
54 lines (49 loc) · 1.07 KB
/
rollup.config.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { builtinModules, createRequire } from 'node:module'
import esbuild from 'rollup-plugin-esbuild'
import dts from 'rollup-plugin-dts'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import nodeResolve from '@rollup/plugin-node-resolve'
import { join } from 'pathe'
const require = createRequire(import.meta.url)
const pkg = require('./package.json')
const entries = {
index: 'src/index.ts',
provider: 'src/provider.ts',
}
const external = [
...builtinModules,
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
'node:inspector',
/^@?vitest(\/|$)/,
]
const plugins = [
nodeResolve(),
json(),
commonjs(),
esbuild({
target: 'node18',
}),
]
export default () => [
{
input: entries,
output: {
dir: 'dist',
format: 'esm',
},
external,
plugins,
},
{
input: entries,
output: {
dir: join(process.cwd(), 'dist'),
entryFileNames: '[name].d.ts',
format: 'esm',
},
external,
plugins: [dts({ respectExternal: true })],
},
]