-
Notifications
You must be signed in to change notification settings - Fork 6
/
rollup.config.mjs
69 lines (64 loc) · 1.41 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import {swc, minify} from 'rollup-plugin-swc3';
import dts from 'rollup-plugin-dts';
import {readFileSync} from 'fs';
const {version, homepage, browser, module, types} = JSON.parse(readFileSync('./package.json'));
const banner = `/*!
* @plusauth/oidc-client-js v${version}
* ${homepage}
* (c) ${(new Date(process.env.SOURCE_DATE_EPOCH ? (process.env.SOURCE_DATE_EPOCH * 1000) : new Date().getTime())).getFullYear()} @plusauth/oidc-client-js Contributors
* Released under the MIT License
*/`;
const plugins = (min) =>
[
commonjs(),
nodeResolve({
browser: true
}),
json(),
swc({
sourceMaps: true
}),
min && minify({
sourceMap: true,
compress: true
})
];
export default [
// UMD build
{
input: 'src/index.ts',
plugins: plugins(true),
output: {
name: 'PlusAuthOIDCClient',
file: browser,
format: 'umd',
indent: false,
sourcemap: true,
},
},
// ES build
{
input: 'src/index.ts',
plugins: plugins(),
output: {
file: module,
banner,
format: 'esm',
indent: false,
sourcemap: true,
},
},
// Types
// dist/types.d.ts
{
input: "src/index.ts",
plugins: [dts()],
output: {
file: types,
format: 'es'
}
}
];