-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrolldown.config.js
More file actions
49 lines (45 loc) · 1.03 KB
/
Copy pathrolldown.config.js
File metadata and controls
49 lines (45 loc) · 1.03 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
/* oxlint-disable import/no-default-export */
import { defineConfig } from 'rolldown'
import pkg from './package.json' with { type: 'json' }
const LIBRARY_NAME = 'RE2JS' // Library name
const EXTERNAL = [] // external modules
const GLOBALS = {} // https://rollupjs.org/guide/en/#outputglobals
const OUTPUT_DIR = 'build'
const banner = `/*!
* ${pkg.name}
* ${pkg.description}
*
* @version v${pkg.version}
* @author ${pkg.author}
* @homepage ${pkg.homepage}
* @repository ${pkg.repository}
* @license ${pkg.license}
*/`
const sharedConfig = {
banner,
exports: 'auto',
globals: GLOBALS,
sourcemap: false
}
export default defineConfig({
input: 'src/index.js',
external: EXTERNAL,
output: [
{
...sharedConfig,
name: LIBRARY_NAME,
file: `${OUTPUT_DIR}/index.umd.js`, // UMD
format: 'umd'
},
{
...sharedConfig,
file: `${OUTPUT_DIR}/index.cjs`, // CommonJS
format: 'cjs'
},
{
...sharedConfig,
file: `${OUTPUT_DIR}/index.js`, // ESM
format: 'es'
}
]
})