/
rollup.config.ts
45 lines (42 loc) · 1.23 KB
/
rollup.config.ts
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
// rollup.config.js
import glob from "glob";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import esbuild from 'rollup-plugin-esbuild'
import livereload from "rollup-plugin-livereload";
import sveltePreprocess from "svelte-preprocess";
import typescript from '@rollup/plugin-typescript';
import svelte from "rollup-plugin-svelte";
import css from "rollup-plugin-css-only";
const production = !process.env.ROLLUP_WATCH;
export default {
input: ["src/bootstrap.ts"].concat(glob.sync("src/api/*.ts")),
output: {
dir: "mt-static/js/build",
format: "esm",
sourcemap: true
},
plugins: [
resolve({
browser: true,
dedupe: ["svelte"],
}),
commonjs(),
esbuild({
sourceMap: true,
minify: production,
}),
css({ output: "bundle.css" }),
svelte({
preprocess: sveltePreprocess({ sourceMap: !production }),
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
},
}),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload("mt-static/js/build"),
typescript({ sourceMap: !production })
],
};