-
Notifications
You must be signed in to change notification settings - Fork 28
/
rollup.config.mjs
52 lines (50 loc) · 1.1 KB
/
rollup.config.mjs
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
/* eslint-disable import/no-extraneous-dependencies */
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import { glob } from 'glob';
import json from '@rollup/plugin-json';
const files = glob.sync('src/**/*.js'); // Get all .js files in src directory and its subdirectories
export default files.map(file => ({
input: file,
output: [
{
file: `lib/${file.substring(4).replace(/\.js$/, '.mjs')}`, // Remove "src/" from the path and replace .js with .mjs
format: 'es',
sourcemap: false,
},
{
file: `lib/${file.substring(4)}`, // Remove "src/" from the path
format: 'cjs',
sourcemap: false,
},
],
plugins: [
resolve(),
commonjs(),
babel({
babelHelpers: 'runtime',
exclude: 'node_modules/**',
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
],
plugins: [
[
'@babel/plugin-transform-runtime',
{
corejs: false,
helpers: true,
regenerator: true,
useESModules: true,
},
],
],
}),
json(),
],
}));