-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.js
45 lines (41 loc) · 1.03 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
import babel from '@rollup/plugin-babel';
import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup';
import pkg from './package.json';
const extensions = ['.js', '.ts', '.tsx'];
const defaultOutputOptions = {
dir: 'lib',
exports: 'named',
};
export default defineConfig({
input: [
'src/index.ts',
'src/constants/index.ts',
'src/icons/index.ts',
'src/utils/index.ts',
],
output: [
{
...defaultOutputOptions,
format: 'cjs',
entryFileNames: '[name].cjs',
},
{
...defaultOutputOptions,
format: 'esm',
entryFileNames: '[name].js',
},
],
preserveModules: true,
plugins: [
typescript(),
babel({
babelHelpers: 'runtime',
extensions,
exclude: 'node_modules/**',
}),
],
// Treat any bare import specifiers as well as subpaths of those as external,
// i.e. `@emotion/styled` and `@emotion/styled/base` should both be external.
external: Object.keys(pkg.dependencies).map((name) => new RegExp(`^${name}`)),
});