-
Notifications
You must be signed in to change notification settings - Fork 375
/
rollup.config.js
47 lines (44 loc) · 1.08 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
import babel from 'rollup-plugin-babel';
import license from 'rollup-plugin-license';
import resolve from '@rollup/plugin-node-resolve';
import modify from 'rollup-plugin-modify';
import { banner, external, stubProcess } from '../../tools/rollup-utils';
import pkg from './package.json';
const commonPlugins = [
resolve({
extensions: ['.js', '.jsx'],
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
license({
banner,
}),
];
const commonConfig = {
input: 'src/index.js',
external: external(__dirname),
plugins: commonPlugins,
};
export default [
{
...commonConfig,
output: {
file: pkg.main, format: 'cjs', sourcemap: true, intro: stubProcess,
},
},
{
...commonConfig,
output: {
file: pkg.module, format: 'es', sourcemap: true,
},
plugins: [
...commonPlugins,
modify({
find: /import (\w+) from '@mui\/icons-material\/(.+)';/,
replace: (match, name, path) => `import ${name}Pkg from '@mui/icons-material/${path}.js'; const ${name} = ${name}Pkg.default;`,
}),
],
},
];