-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.ts
66 lines (62 loc) · 1.5 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { RollupOptions } from 'rollup';
import { nodeResolve } from '@rollup/plugin-node-resolve';
// rollup.config.js (building more than one bundle)
const path = require('path');
const rollupTypescript = require('@rollup/plugin-typescript');
const terser = require('rollup-plugin-terser').terser;
const cwd = (pathname: string): string => path.resolve(process.cwd(), pathname);
const config: RollupOptions[] = [
{
input: cwd('./src/index.ts'),
plugins: [
nodeResolve(),
rollupTypescript({
tsconfig: cwd('./tsconfig.esm.json'),
}),
terser(),
],
output: {
dir: cwd('./esm'),
format: 'es',
},
},
// {
// input: cwd('./src/index.ts'),
// plugins: [nodeResolve(), rollupTypescript({
// tsconfig: cwd('./tsconfig.esm.es6.json')
// })],
// output: {
// format: "es",
// file: cwd('./esm/es6.js')
// }
// },
{
input: cwd('./src/index.ts'),
plugins: [
nodeResolve(),
rollupTypescript({
tsconfig: cwd('./tsconfig.umd.json'),
}),
terser(),
],
output: {
format: 'umd',
name: 'Agent',
exports: 'named',
dir: cwd('./lib'),
},
},
// {
// input: cwd('./src/index.ts'),
// plugins: [nodeResolve(), rollupTypescript({
// tsconfig: cwd('./tsconfig.umd.es6.json')
// })],
// output: {
// format: "umd",
// name: 'Agent',
// exports: "named",
// file: cwd('./lib/es6.js')
// }
// }
];
export default config;