-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
49 lines (45 loc) · 1.51 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
import package_ from './package.json' assert { type: 'json' };
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
import cleanup from 'rollup-plugin-cleanup';
import del from 'rollup-plugin-delete';
import externals from 'rollup-plugin-node-externals';
/**
* @type {import('rollup').RollupOptions[]}
*/
export default [
{
input: './src/index.ts',
output: [{ file: package_.main, format: 'module' }],
plugins: [
// Delete contents of target folder
del({
targets: package_.files,
}),
// Compile source (typescript) to javascript
typescript({
tsconfig: './tsconfig.json',
}),
// Remove things like comments and whitespace
cleanup({
extensions: ['.ts', '.js'],
}),
/**
* Mark all dependencies and node defaults as external to prevent
* Rollup from including them in the bundle. We'll let the package
* manager take care of dependency resolution and stuff so we don't
* have to download the exact same code multiple times, once in
* this bundle and also as a dependency of another package.
*/
externals(),
],
},
{
input: './src/index.ts',
output: [{ file: package_.types, format: 'module' }],
plugins: [
// Generate types (.d.ts)
dts(),
],
},
];