forked from psychobolt/react-pie-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.common.js
43 lines (38 loc) · 1014 Bytes
/
rollup.config.common.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
import fs from 'fs';
import path from 'path';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
const { projectList, INCLUDES } = require('./project-list');
const ROOT_RESOLVE = path.resolve();
const config = {
input: path.resolve(ROOT_RESOLVE, 'src', 'index.js'),
plugins: [
resolve(),
commonjs({
include: /node_modules/,
}),
babel({
exclude: /node_modules/,
babelHelpers: 'bundled',
}),
],
external: [
...projectList.map(({ name }) => name),
'react',
'react-dom',
'react-is',
'styled-components',
'styled-components-theme-connector',
],
};
export const configs = INCLUDES.length === 0 && fs.statSync(config.input).isFile()
? [ROOT_RESOLVE, config]
: Object.entries(projectList.reduce((cfg, { location }) => ({
...cfg,
[location]: {
...config,
input: `${location}/src/index.js`,
},
}), {}));
export default config;