forked from marchaos/jest-mock-extended
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrollup.config.mjs
50 lines (47 loc) · 981 Bytes
/
rollup.config.mjs
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
import pkg from './package.json' with { type: "json" };
import esbuild from 'rollup-plugin-esbuild';
import { dts } from 'rollup-plugin-dts';
import { defineConfig } from 'rollup';
const external = [...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies)]
const input = "src/index.ts"
const configs = [
defineConfig({
input,
plugins: [
esbuild({
tsconfig: 'tsconfig.json',
}),
],
output: [
{
file: 'lib/esm/index.js',
format: 'es',
sourcemap: true,
},
{
file: 'lib/index.cjs',
format: 'cjs',
sourcemap: true,
},
],
external
}),
defineConfig({
input,
plugins: [dts()],
output: [
{
file: `lib/esm/index.d.ts`,
format: 'es',
sourcemap: true,
},
{
file: `lib/index.d.cts`,
format: 'cjs',
sourcemap: true,
},
],
external
}),
];
export default configs;