This repository has been archived by the owner on May 19, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathrollup.config.js
78 lines (73 loc) · 1.51 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import beep from '@rollup/plugin-beep';
import commonjs from '@rollup/plugin-commonjs';
import eslint from '@rollup/plugin-eslint';
import resolve from '@rollup/plugin-node-resolve';
import strip from '@rollup/plugin-strip';
import ts from '@wessberg/rollup-plugin-ts';
import filesize from 'rollup-plugin-filesize';
import { terser } from 'rollup-plugin-terser';
const suite = (input, output, dev = false) => ({
input,
plugins: [
eslint(),
commonjs(),
resolve({ extensions: ['.ts'] }),
ts(),
beep(),
dev
? undefined
: strip({
functions: ['console.*', 'error'],
include: '**/*.(ts)',
}),
],
output,
onwarn: () => {},
});
export const unit = ({ file, format, minify }) => ({
file,
format,
name: 'Lucia',
strict: true,
plugins: minify
? [
terser(),
filesize({
showBrotliSize: true,
showMinifiedSize: false,
showBeforeSizes: 'release',
showGzippedSize: false,
}),
]
: [],
});
const devSuite = suite(
'./src/index.ts',
[
unit({
file: './dist/lucia.js',
format: 'iife',
}),
],
true,
);
const prodSuite = suite('./src/index.ts', [
unit({
file: './dist/lucia.esm.js',
format: 'esm',
}),
unit({
file: './dist/lucia.cjs.js',
format: 'cjs',
}),
unit({
file: './dist/lucia.umd.js',
format: 'umd',
}),
unit({
file: './dist/lucia.min.js',
format: 'iife',
minify: true,
}),
]);
export default [devSuite, prodSuite];