-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.mjs
51 lines (49 loc) · 1.08 KB
/
rollup.config.mjs
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
import { readdirSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { terser } from 'rollup-plugin-terser'
import del from 'rollup-plugin-delete'
const __dirname = fileURLToPath(new URL('./', import.meta.url))
const srcPath = join(__dirname, 'src')
const files = readdirSync(srcPath).map((filePath) => join(srcPath, filePath))
/**
* @type { import('rollup').InputOptions[] }
*/
export default [
{
input: 'src/zhconver.js',
plugins: [del({ targets: 'dist/*' })],
output: {
sourcemap: true,
file: 'dist/zhconver.js',
format: 'iife',
name: 'zhconver',
plugins: [terser()]
}
},
{
input: 'src/conver.js',
output: {
sourcemap: true,
file: 'dist/conver.js',
format: 'iife',
name: 'conver',
plugins: [terser()]
}
},
{
input: files,
output: [
{
dir: 'dist/esm',
format: 'esm',
entryFileNames: '[name].mjs'
},
{
dir: 'dist/cjs',
format: 'cjs',
entryFileNames: '[name].cjs'
}
]
}
]