forked from DanielBretzigheimer/svg2pdf.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
75 lines (69 loc) · 1.64 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import typescript from '@rollup/plugin-typescript'
import { terser } from 'rollup-plugin-terser'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import license from 'rollup-plugin-license'
import pkg from './package.json'
function licenseBanner() {
return license({
banner: {
content: { file: './LICENSE' }
}
})
}
const umdExternals = [
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.optionalDependencies || {})
]
const externals = [...Object.keys(pkg.dependencies || {}), ...umdExternals]
const globals = {
cssesc: 'cssesc',
jspdf: 'jspdf',
svgpath: 'svgpath'
}
const umd = {
input: 'src/svg2pdf.ts',
output: [
{
file: pkg.browser.replace('.es.min.', '.umd.'),
format: 'umd',
name: 'svg2pdf',
exports: 'named',
sourcemap: true,
globals
},
{
file: pkg.browser.replace('.es.', '.umd.'),
format: 'umd',
name: 'svg2pdf',
exports: 'named',
sourcemap: true,
globals,
plugins: [terser({})]
}
],
external: umdExternals,
plugins: [typescript(), commonjs({ extensions: ['.js', '.ts'] }), resolve(), licenseBanner()]
}
const es = {
input: 'src/svg2pdf.ts',
output: [
{
file: pkg.module.replace('.min', ''),
format: 'es',
name: 'svg2pdf',
sourcemap: true,
plugins: []
},
{
file: pkg.module,
format: 'es',
name: 'svg2pdf',
sourcemap: true,
plugins: [terser({})]
}
],
external: externals,
plugins: [typescript(), commonjs({ extensions: ['.js', '.ts'] }), resolve(), licenseBanner()]
}
export default [umd, es]