forked from apple/ml-hierarchical-confusion-matrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
85 lines (82 loc) · 2.39 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import autoPreprocess from 'svelte-preprocess';
import commonjs from '@rollup/plugin-commonjs';
import css from 'rollup-plugin-css-only';
import json from '@rollup/plugin-json';
import livereload from 'rollup-plugin-livereload';
import pkg from './package.json';
import resolve from '@rollup/plugin-node-resolve';
import { Server } from 'http';
import svelte from 'rollup-plugin-svelte';
import { terser } from 'rollup-plugin-terser';
import typescript from '@rollup/plugin-typescript';
const copyright = `// ${pkg.name} v${pkg.version} Copyright ${(new Date).getFullYear()} ${pkg.author.name}`;
const production = !process.env.ROLLUP_WATCH;
export default [
// App
{
input: 'src/app.ts',
output: {
banner: copyright,
sourcemap: !production,
format: 'iife',
name: 'app',
file: 'public/app.js',
},
plugins: [
svelte({
preprocess: autoPreprocess(),
compilerOptions: {
dev: !production,
},
}),
css({ output: 'bundle.css' }),
typescript({
noEmitOnError: false,
sourceMap: !production,
}),
json(),
resolve({
browser: true,
dedupe: ['svelte'],
}),
commonjs(),
!production && Server(),
!production && livereload('public'),
production && terser({ output: { preamble: copyright } }),
],
watch: {
clearScreen: false,
},
},
// Library
{
input: 'src/lib.ts',
output: {
banner: copyright,
sourcemap: !production,
format: 'umd',
name: 'confMat',
file: 'public/confMat.js',
},
plugins: [
svelte({
preprocess: autoPreprocess(),
emitCss: false,
compilerOptions: {
dev: !production,
},
}),
typescript({
noEmitOnError: false,
sourceMap: !production,
}),
json(),
resolve({
browser: true,
dedupe: ['svelte'],
}),
commonjs(),
terser({ output: { preamble: copyright } }),
],
},
];