-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
61 lines (56 loc) · 1.7 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
55
56
57
58
59
60
61
import package_ from './package.json' with { type: 'json' };
import typescript from 'rollup-plugin-typescript2';
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_.exports.import,
format: 'module',
},
{
file: package_.exports.require,
format: 'commonjs',
},
],
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 as external to prevent Rollup from
* including them in the bundle. We'll let the package manager
* take care of dependency resolution so we don't have to
* download the exact same code multiple times. Once in this
* bundle and as a dependency of another package.
*/
externals(),
],
},
{
input: './src/index.ts',
output: [
{
file: package_.types,
},
],
plugins: [
// Generate types (.d.ts)
dts(),
],
},
];