-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
56 lines (51 loc) · 1.56 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
import alias from '@rollup/plugin-alias';
import json from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import svelte from 'rollup-plugin-svelte';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
const backendConfig = {
input: 'src/routes/routes.ts',
output: {
file: 'dist/routes.js',
format: 'es',
},
plugins: [typescript(), json()],
external: ['@hapi/boom', 'ajv', 'd3-format', 'joi', 'module', 'path', 'simple-statistics', 'svelte/internal', 'uglify-js', 'url'],
};
const frontendConfig = {
input: 'src/components/index.svelte',
output: {
name: 'window.q_table',
file: 'dist/Q-Table.js',
format: 'iife',
},
plugins: [
typescript(),
json(),
svelte({
preprocess: sveltePreprocess(),
emitCss: false,
compilerOptions: {},
onwarn: (warning, handler) => {
// Silence accessibility warnings.
if (warning.code.startsWith('a11y-')) {
return;
}
handler(warning);
},
}),
nodeResolve({ browser: true }),
terser(),
alias({
entries: [
// If you add a new top-level-folder besides src which you want to use, add it here.
{ find: /^@src(\/|$)/, replacement: `${__dirname}/src/` },
{ find: /^@cps(\/|$)/, replacement: `${__dirname}/src/components/` },
{ find: /^@helpers(\/|$)/, replacement: `${__dirname}/src/helpers/` },
],
}),
],
};
export default [frontendConfig, backendConfig];