-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
79 lines (76 loc) · 1.67 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
76
77
78
79
import { nodeResolve as resolve } from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup';
import copy from 'rollup-plugin-copy';
import dts from 'rollup-plugin-dts';
import { terser } from 'rollup-plugin-terser';
const input = 'src/index.ts';
const banner = `
/**
* @larmbox/phone-input ${process.env.npm_package_version}
* (c) 2022 Larmbox, Jonatan Wackström
* @license MIT
*/
`.trimStart()
export default defineConfig([
{
input,
output: {
name: 'phoneInput',
file: 'dist/index.browser.js',
format: 'umd',
sourcemap: false,
banner
},
plugins: [resolve(), typescript()],
},
{
input,
output: {
name: 'phoneInput',
file: 'dist/index.browser.min.js',
format: 'umd',
sourcemap: false,
},
plugins: [
resolve(),
typescript(),
terser(),
copy({
targets: [
{ src: 'dist/index.browser.min.js', dest: 'docs/dist/' },
{ src: 'dist/flags.webp', dest: 'docs/dist/' },
{ src: 'dist/style/flags.css', dest: 'docs/dist/style/' },
{ src: 'dist/style/phone-input.css', dest: 'docs/dist/style/' },
]
})],
},
{
input,
output: {
file: 'dist/index.js',
format: 'cjs',
sourcemap: true,
banner
},
plugins: [resolve(), typescript()],
},
{
input,
output: {
file: 'dist/index.min.js',
format: 'cjs',
sourcemap: true,
},
plugins: [resolve(), typescript(), terser()],
},
{
input,
output: {
file: 'dist/index.d.ts',
format: 'es',
banner
},
plugins: [dts()],
},
]);