-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.mjs
89 lines (89 loc) · 2.19 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-var-requires */
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
import external from 'rollup-plugin-peer-deps-external';
import pkg from './package.json' assert { type: 'json' };
/**
* Comment with library information to be appended in the generated bundles.
*/
const banner = `/**
* ${pkg.name} ${pkg.version}
* (c) ${pkg.author.name} ${pkg.author.email}
* Released under the ${pkg.license} License.
*/
`.trim();
/**
* @type {import('rollup').RollupOptions}
*/
const options =
{
input: 'src/index.ts',
output: [
{
banner,
file: './dist/umd/index.js',
format: 'umd',
sourcemap: true,
name: "NEWTON",
},
{
banner,
file: './dist/umd/index.min.js',
format: 'umd',
sourcemap: true,
name: "NEWTON",
plugins: [terser()]
},
{
banner,
file: pkg.main,
format: 'cjs',
sourcemap: true,
name: 'NEWTON'
},
{
banner,
file: './dist/esm/index.js',
format: 'esm',
sourcemap: true
},
{
banner,
file: './dist/esm/index.min.js',
format: 'esm',
sourcemap: true,
plugins: [terser()]
},
{
banner,
file: './dist/system/index.js',
format: 'system',
sourcemap: true
},
{
banner,
file: './dist/system/index.min.js',
format: 'system',
sourcemap: true,
plugins: [terser()]
}
],
plugins: [
external(),
resolve(),
commonjs(),
typescript({ tsconfig: './tsconfig.json' })
]
};
export default [
options,
{
input: 'dist/esm/types/index.d.ts',
output: [{ file: pkg.types, format: "esm" }],
plugins: [dts()],
}
];