-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
69 lines (63 loc) · 1.66 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
import svelte from "rollup-plugin-svelte";
import sveltePreprocess from "svelte-preprocess";
import { vitePreprocess } from '@sveltejs/kit/vite';
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import css from "rollup-plugin-css-only";
import serve from "rollup-plugin-serve";
import json from "@rollup/plugin-json";
import typescript from '@rollup/plugin-typescript';
import livereload from "rollup-plugin-livereload";
const production = true; //false;// !process.env.ROLLUP_WATCH;
export default {
input: "src/widget.js",
output: {
file: "static/public/bundle.js",
format: "iife",
name: "app",
sourcemap: production,
},
plugins: [
// compile svelte with tailwindcss as preprocess (including autoprefixer)
svelte({
preprocess: [
sveltePreprocess({
sourceMap: !production,
postcss: {
plugins: [tailwindcss(), autoprefixer()],
},
}),
vitePreprocess(),
],
}),
// resolve external dependencies from NPM
resolve({
browser: true,
preferBuiltins: false,
}),
json(),
commonjs(),
typescript({
rootDir: 'src'
}),
// export CSS in separate file for better performance
css({ output: "bundle.css" }),
// postcss({
// config: {
// path: "./postcss.config.js",
// },
// extensions: [".css"],
// minimize: true,
// inject: {
// insertAt: "top",
// },
// }),
// start a local livereload server on public/ folder
!production && serve("public/"),
!production && livereload("public/"),
// minify bundles in production mode
// production && terser(),
],
};