-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
rollup.config.js
43 lines (39 loc) · 1.23 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
import livereload from "rollup-plugin-livereload";
import resolve from "@rollup/plugin-node-resolve";
import svelteSVG from "rollup-plugin-svelte-svg";
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";
import cleaner from "rollup-plugin-cleaner";
import svelte from "rollup-plugin-svelte";
import alias from "@rollup/plugin-alias";
import css from "rollup-plugin-css-only";
import json from "@rollup/plugin-json";
const watch = process.env.ROLLUP_WATCH;
const frontDir = "front-src";
const publicDir = "app/client";
const jsDir = `${publicDir}/js`;
const cssDir = `${publicDir}/css`;
const clientDir = `${frontDir}/client`;
const overlayDir = `${frontDir}/overlay`;
export default {
input: [`${clientDir}/index.js`, `${overlayDir}/overlay.js`],
output: {
format: "es",
dir: jsDir,
sourcemap: true,
},
plugins: [
json(),
alias({
entries: [{ find: "@", replacement: `${__dirname}/${clientDir}` }],
}),
resolve({ browser: true, dedupe: ["svelte"] }),
commonjs(),
svelteSVG(),
svelte({ dev: watch }),
css({ output: `${cssDir}/index.css` }),
watch && livereload(publicDir),
!watch && cleaner({ targets: [jsDir] }),
!watch && terser(),
],
};