forked from fabricjs/fabric.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
42 lines (39 loc) · 1.07 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
import json from '@rollup/plugin-json';
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
import { terser } from 'rollup-plugin-terser';
import ts from 'rollup-plugin-ts';
const runStats = Number(process.env.BUILD_STATS);
const splitter = /\n|\s|,/g;
// https://rollupjs.org/guide/en/#configuration-files
export default {
input: process.env.BUILD_INPUT?.split(splitter) || ['./index.js'],
output: [
{
file: process.env.BUILD_OUTPUT || './dist/fabric.js',
name: 'fabric',
format: 'cjs',
sourcemap: true,
},
Number(process.env.MINIFY)
? {
file: process.env.BUILD_MIN_OUTPUT || './dist/fabric.min.js',
name: 'fabric',
format: 'cjs',
plugins: [
runStats &&
sizeSnapshot({
snapshotPath: 'cli_output/build_size.json',
}),
terser(),
],
}
: null,
],
// see list of plugins (not comprehensive): https://github.com/rollup/awesome
plugins: [
json(),
ts({
/* Plugin options */
}),
],
};