-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
executable file
·52 lines (48 loc) · 1.21 KB
/
rollup.config.mjs
File metadata and controls
executable file
·52 lines (48 loc) · 1.21 KB
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
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
const outDir = './bundle';
const outName = 'lonad-bundle';
const outExt = '.js';
const bundleName = 'lonad';
function createOutputConfig(format, sourceMap = false, formatName = format) {
return {
file: `${outDir}/${outName}${formatName && formatName.length > 0 ? `.${formatName}` : ''}${outExt}`,
format,
name: bundleName,
sourcemap: sourceMap,
};
}
const config = [
{
input: 'src/index.ts',
output: [
createOutputConfig('es', true),
createOutputConfig('cjs', true),
],
plugins: [
typescript({ declaration: false, sourceMap: true, inlineSources: true })
],
external: ['lodash.flow'],
},
{
input: 'src/index.ts',
output: [
createOutputConfig('iife', true, ''),
{
...createOutputConfig('iife', false, 'min'),
plugins: [terser()]
}
],
plugins: [
resolve({
browser: true,
resolveOnly: ['lodash.flow'],
}),
commonjs(),
typescript({ declaration: false }),
],
}
];
export default config;