-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
119 lines (117 loc) · 2.53 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import fs from 'node:fs'
import path from 'node:path'
import typescript from '@rollup/plugin-typescript'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import terser from '@rollup/plugin-terser'
const packageJson = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf-8'))
const name = '__nsx_color_tools'
const banner = `/*!
* ${packageJson.name} v${packageJson.version} | ${packageJson.license} License
*
* Copyright (c) 2024-present NOuSantx <[email protected]>
*
* Built Date: ${new Date().toString()}
*/`
const config = [
{
input: 'src/cli.ts',
output: [
{
file: 'dist/cli.min.js',
format: 'es',
plugins: [
terser({
format: {
comments: false,
preamble: banner
},
mangle: true,
compress: {
passes: 2
}
})
]
}
],
plugins: [typescript(), resolve(), commonjs()]
},
{
input: 'src/index.ts',
output: [
{
file: 'dist/index.cjs',
format: 'cjs',
exports: 'named',
banner,
sourcemap: true
},
{
file: 'dist/index.min.cjs',
format: 'cjs',
exports: 'named',
sourcemap: true,
plugins: [
terser({
format: {
comments: false,
preamble: banner
},
mangle: true,
compress: {
passes: 2
}
})
]
},
{
file: 'dist/index.umd.js',
format: 'umd',
exports: 'named',
sourcemap: true,
name,
banner
},
{
file: 'dist/index.umd.min.js',
format: 'umd',
exports: 'named',
sourcemap: true,
name,
plugins: [
terser({
format: {
comments: false,
preamble: banner
}
})
]
},
{
file: 'dist/index.esm.js',
format: 'es',
banner,
sourcemap: true
},
{
file: 'dist/index.esm.min.js',
sourcemap: true,
format: 'es',
plugins: [
terser({
format: {
comments: false,
preamble: banner
},
mangle: true,
compress: {
passes: 2
}
})
]
}
],
plugins: [typescript(), resolve(), commonjs()]
}
]
export default config