-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.mjs
59 lines (54 loc) · 1.15 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
/*
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import url from '@rollup/plugin-url';
import postcss from 'rollup-plugin-postcss';
import pkg from './package.json' with { type: 'json' };
const plugins = [
url({
include: [
'**/fonts/**/*.woff',
'**/fonts/**/*.woff2',
'**/fonts/**/*.ttf',
'**/fonts/**/*.eot',
'**/fonts/**/*.svg'
],
limit: Infinity
}),
postcss(),
nodeResolve({
extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx', '.jsx']
}),
commonjs(),
babel({
// read configs from .babelrc
babelHelpers: 'runtime',
extensions: ['.js', '.jsx', '.ts', '.tsx'],
ignore: ['node_modules']
})
];
const external = ['react', 'react-dom', 'styled-components', 'lodash'];
export default [
{
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
interop: 'compat'
},
{
file: pkg.module,
format: 'esm',
interop: 'compat'
}
],
plugins,
external
}
];