-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
63 lines (55 loc) · 1.47 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
import ts from 'rollup-plugin-typescript2'
import prettier from 'rollup-plugin-prettier'
import { terser } from 'rollup-plugin-terser'
import { version, name } from './package.json'
const formats = ['esm.min']
const copyright =
'MIT@Copyright (c) 2023-present Eyelly Wu <https://github.com/eyelly-wu>'
const banner = `/*
* ${name}
* v${version}
* ${new Date().toLocaleString()}
* ${copyright}
*/`
const minBanner = `// ${name} v${version} ${new Date().toLocaleString()} ${copyright}`
export default formats.map((format, index) => {
const isLast = index === formats.length - 1
let pluginsExtra = []
const suffix = format.split('.')[1]
if (format.includes('.')) {
pluginsExtra.push(
terser({
format: {
comments: /@i18n-pro\/vue2/,
},
}),
)
}
return {
input: 'src/index.ts',
output: {
file: `dist/src/index${suffix ? '.' + suffix : ''}.js`,
format: format.includes('.') ? format.split('.')[0] : format,
banner: suffix ? minBanner : banner,
name: 'vueI18nPro',
},
plugins: [
ts({
useTsconfigDeclarationDir: isLast,
tsconfigOverride: {
compilerOptions: {
removeComments: false,
declaration: isLast,
declarationDir: 'dist',
module: 'esnext',
target: 'es5',
resolveJsonModule: true,
},
include: ['src'],
},
}),
prettier(),
...pluginsExtra,
],
}
})