-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
35 lines (31 loc) · 941 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
import glob from 'glob'; // Ensure you have the 'glob' package installed
const inputFiles = glob.sync('src/processors/**/*.ts').filter((file) => {
// exclude tests and definitions
return !file.endsWith('.test.ts') && !file.endsWith('.d.ts');
});
const configs = inputFiles.map(inputFile => {
const fileName = inputFile.match(/\/([^\/]+)\.ts$/)[1];
return {
input: inputFile,
output: {
file: `src/bundles/${fileName}-bundle.js`,
format: 'iife',
},
plugins: [
resolve({
browser: true,
preferBuiltins: false,
}),
commonjs(),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
typescript(),
],
};
});
export default configs;