forked from gravity-ui/navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
68 lines (64 loc) · 1.86 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
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import svgr from '@svgr/rollup';
import json from 'rollup-plugin-json';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
const packageJson = require('./package.json');
const input = [
'src/index.ts',
'src/components/ActionBar/index.ts',
'src/components/Title/index.ts',
'src/components/HotkeysPanel/index.ts',
'src/components/Settings/index.ts',
'src/components/MobileHeader/index.ts',
'src/components/AsideHeader/AsideHeader.tsx',
'src/components/AsideHeader/AsideHeaderContext.ts',
'src/components/Drawer/Drawer.tsx',
'src/components/FooterItem/FooterItem.tsx',
'src/components/AsideHeader/components/PageLayout/PageLayout.tsx',
'src/components/AsideHeader/components/PageLayout/PageLayoutAside.tsx',
'src/components/AsideHeader/components/PageLayout/AsideFallback.tsx',
];
const getPlugins = (outDir) => {
return [
peerDepsExternal(),
json(),
resolve(),
commonjs(),
typescript({
typescript: require('typescript'),
tsconfig: './tsconfig.publish.json',
outDir,
}),
postcss({
minimize: true,
}),
svgr(),
];
};
export default [
{
input,
output: [
{
dir: packageJson.module,
format: 'esm',
sourcemap: true,
},
],
plugins: getPlugins(packageJson.module),
},
{
input,
output: [
{
dir: packageJson.main,
format: 'cjs',
sourcemap: true,
},
],
plugins: getPlugins(packageJson.main),
},
];