/
rollup.config.js
53 lines (49 loc) · 1.04 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
import { builtinModules } from 'node:module'
import esbuild from 'rollup-plugin-esbuild'
import dts from 'rollup-plugin-dts'
import { defineConfig } from 'rollup'
import pkg from './package.json' assert { type: 'json' }
const external = [
...builtinModules,
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
'@vitest/utils/diff',
'@vitest/utils/error',
]
const plugins = [
esbuild({
target: 'node14',
}),
]
export default defineConfig([
{
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm',
entryFileNames: '[name].js',
chunkFileNames: 'chunk-[name].js',
},
external,
plugins,
onwarn,
},
{
input: 'src/index.ts',
output: {
dir: 'dist',
entryFileNames: '[name].d.ts',
format: 'esm',
},
external,
plugins: [
dts({ respectExternal: true }),
],
onwarn,
},
])
function onwarn(message) {
if (['EMPTY_BUNDLE', 'CIRCULAR_DEPENDENCY'].includes(message.code))
return
console.error(message)
}