-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathrollup.config.js
42 lines (39 loc) · 1010 Bytes
/
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
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import fs from 'fs';
import path from 'path';
const pkg = require('./package.json');
const dependencies = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
];
const builds = [];
fs.readdirSync(`${__dirname}/src/`).forEach(file => {
builds.push({
input: `src/${file}`,
external: [/@babel\/runtime/, /react-syntax-highlighter/, ...dependencies],
output: [
{
file: `dist/cjs/${file}`,
format: 'cjs',
sourcemap: false,
name: 'idyll-components',
exports: 'auto'
},
{
file: `dist/esm/${path.parse(file).name}.mjs`,
format: 'esm',
sourcemap: false,
exports: 'auto'
}
],
plugins: [
babel({
babelHelpers: 'runtime',
exclude: 'node_modules/**' // only transpile our source code
}),
commonjs()
]
});
});
export default builds;