-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
68 lines (65 loc) · 1.21 KB
/
rollup.config.js
File metadata and controls
68 lines (65 loc) · 1.21 KB
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
import terser from "@rollup/plugin-terser"
import replace from "@rollup/plugin-replace"
const banner = `/**
* KnHttp v` + process.env.npm_package_version + ` (` + new Date().toISOString() + `)
* Copyright (c) 2022 - ` + new Date().getFullYear() + ` Florent VIALATTE
* Released under the MIT license
*/`
const replacePlugin = replace({
preventAssignment: true,
values: {
'process.env.npm_package_version': JSON.stringify(process.env.npm_package_version)
}
})
export default [
{
input: 'src/kn-http.js',
output: {
format: 'esm',
file: 'dist/kn-http.js',
banner: banner,
exports: 'named'
},
plugins: [
replacePlugin
]
},
{
input: 'src/kn-http.js',
output: {
name: 'KnHttp',
format: 'iife',
file: 'dist/kn-http.iife.js',
banner: banner
},
plugins: [
replacePlugin
]
},
{
input: 'src/kn-http.js',
output: {
name: 'KnHttp',
format: 'iife',
file: 'dist/kn-http.iife.min.js'
},
plugins: [
replacePlugin,
terser({
ecma: '2020',
compress: {
ecma: '2020',
drop_console: true,
drop_debugger: true,
passes: 2
},
format: {
comments: false,
ecma: '2020',
quote_style: 3,
preamble: banner
}
})
]
}
]