-
Notifications
You must be signed in to change notification settings - Fork 130
/
rollup.config.js
45 lines (40 loc) · 1.18 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
import { createRequire } from 'node:module'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
const require = createRequire(import.meta.url)
const pkg = require('./package.json')
const plugins = [nodeResolve(), typescript({ tsconfig: './tsconfig.json' })]
const minify = terser({
format: {
preamble: `/*! a11y-dialog ${pkg.version} — © Kitty Giraudel */`,
},
})
const umdCfg = {
format: 'umd',
name: 'A11yDialog',
exports: 'default',
}
export default [
{
input: 'src/index.ts',
plugins: plugins,
output: [
// UMD
{ file: 'dist/a11y-dialog.js', ...umdCfg },
{ file: 'dist/a11y-dialog.min.js', ...umdCfg, plugins: [minify] },
// ESM
{ file: 'dist/a11y-dialog.esm.js', format: 'esm' },
{ file: 'dist/a11y-dialog.esm.min.js', format: 'esm', plugins: [minify] },
// CJS
{ file: 'dist/a11y-dialog.cjs', format: 'cjs' },
// Tests
{ file: 'cypress/fixtures/a11y-dialog.js', ...umdCfg },
],
},
{
input: 'src/dom-utils.ts',
plugins: plugins,
output: [{ file: 'cypress/fixtures/dom-utils.js' }],
},
]