forked from kozakdenys/qr-code-styling
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrollup.config.ts
More file actions
68 lines (65 loc) · 1.88 KB
/
rollup.config.ts
File metadata and controls
68 lines (65 loc) · 1.88 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 compiler from '@liquid-js/rollup-plugin-closure-compiler'
import commonjs from '@rollup/plugin-commonjs'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import { type RollupOptions } from 'rollup'
import { minifyTemplateLiterals } from 'rollup-plugin-minify-template-literals'
const common = () => [
typescript({
declaration: true,
declarationDir: './lib/',
inlineSources: true,
tsconfig: 'tsconfig.lib.json'
}),
commonjs(),
minifyTemplateLiterals({
options: {
shouldMinify: () => true
}
})
]
const bundle = () => [
nodeResolve(),
compiler({
language_in: 'ECMASCRIPT_NEXT',
language_out: 'ECMASCRIPT_NEXT'
}),
terser()
]
export default new Array<RollupOptions>(
{
input: {
'qr-code-styling': 'src/index.ts',
'kanji': 'src/kanji.ts',
'plugin-utils': 'src/plugins/utils.ts',
'border-plugin': 'src/plugins/border.ts',
'font-faces-plugin': 'src/plugins/font-faces.ts'
},
output: {
dir: './lib',
sourcemap: true,
format: 'esm',
name: 'QRCodeStyling'
},
plugins: [...common(), ...bundle()]
},
{
input: 'src/node.ts',
output: {
file: './lib/qr-code-styling-node.js',
sourcemap: true,
format: 'esm'
},
plugins: [
...common(),
compiler({
language_in: 'ECMASCRIPT_NEXT',
language_out: 'ECMASCRIPT_NEXT',
formatting: 'PRETTY_PRINT',
compilation_level: 'WHITESPACE_ONLY'
}),
terser({ mangle: false, ecma: 2024 as any, output: { beautify: true } })
]
}
)