-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.cjs
65 lines (57 loc) · 1.56 KB
/
rollup.config.cjs
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
const ts = require('rollup-plugin-typescript2')
const prettier = require('rollup-plugin-prettier')
const { terser } = require('rollup-plugin-terser')
const { version, name } = require('./package.json')
const solid = require('vite-plugin-solid')
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}`
module.exports = 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\/solid/,
},
}),
)
}
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: 'solidI18nPro',
},
plugins: [
solid(),
ts({
useTsconfigDeclarationDir: isLast,
tsconfigOverride: {
compilerOptions: {
removeComments: false,
declaration: false,
module: 'esnext',
target: 'es5',
resolveJsonModule: true,
},
include: ['./src'],
exclude: ['./docs', './test'],
},
}),
prettier(),
...pluginsExtra,
],
}
})