generated from bradgarropy/svelte-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
55 lines (52 loc) · 1.48 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
import commonjs from "@rollup/plugin-commonjs"
import resolve from "@rollup/plugin-node-resolve"
import copy from "rollup-plugin-copy"
import css from "rollup-plugin-css-only"
import livereload from "rollup-plugin-livereload"
import serve from "rollup-plugin-serve"
import svelte from "rollup-plugin-svelte"
import {terser} from "rollup-plugin-terser"
import image from "svelte-image"
const path = "dist"
const production = process.env.CONTEXT === "production"
const development = !production
const watch = !!process.env.ROLLUP_WATCH
const config = {
input: "src/index.js",
output: {
file: `${path}/bundle.js`,
sourcemap: development,
},
plugins: [
svelte({
compilerOptions: {
dev: development,
},
preprocess: {
...image({
outputDir: "images",
publicDir: "static",
placeholder: "blur",
}),
},
}),
css({output: "bundle.css"}),
resolve({browser: true}),
commonjs(),
copy({
targets: [
{src: "static/*", dest: path},
{src: "static/.*", dest: path},
],
}),
production && terser(),
watch &&
serve({
contentBase: path,
port: 5000,
historyApiFallback: true,
}),
watch && livereload(path),
],
}
export default config