-
Notifications
You must be signed in to change notification settings - Fork 15
/
rollup.config.js
56 lines (54 loc) · 1.6 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
import pkg from './package.json';
import typescript from '@rollup/plugin-typescript';
import { terser } from "rollup-plugin-terser";
import banner2 from 'rollup-plugin-banner2';
import copy from 'rollup-plugin-copy';
export default [
// browser-friendly UMD build (all)
{
input: 'src/index.umd.all.ts',
output: {
name: 'Quadtree',
file: pkg.browser,
format: 'umd',
exports: 'default'
},
plugins: [
typescript({ tsconfig: './tsconfig.json' }), // so Rollup can convert TypeScript to JavaScript
terser(), //minify,
banner2(() => `/* ${pkg.repository.url} v${pkg.version} */\n`),
]
},
// browser-friendly UMD build (basic)
{
input: 'src/index.umd.basic.ts',
output: {
name: 'Quadtree',
file: pkg.browser.replace('.umd.full.', '.umd.basic.'),
format: 'umd',
exports: 'default'
},
plugins: [
typescript({ tsconfig: './tsconfig.json' }), // so Rollup can convert TypeScript to JavaScript
terser(), //minify,
banner2(() => `/* ${pkg.repository.url} v${pkg.version} */\n`),
// copy the full version deferred
copy({
targets: [
{ src: pkg.browser, dest: 'docs/examples/assets/' },
]
}),
]
},
// CommonJS (for Node) and ES module (for bundlers) build
{
input: 'src/index.esm.ts',
plugins: [
typescript({ tsconfig: './tsconfig.json' }), // so Rollup can convert TypeScript to JavaScript
],
output: [
{ file: pkg.main, format: 'cjs', preferConst: true },
{ file: pkg.module, format: 'es', preferConst: true }
]
}
];