-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
56 lines (53 loc) · 1.38 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 commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import html2 from "rollup-plugin-html2";
import svelte from "rollup-plugin-svelte";
import serve from "rollup-plugin-serve";
import postcss from "rollup-plugin-postcss";
import { terser } from "rollup-plugin-terser";
import livereload from "rollup-plugin-livereload";
import sveltePreprocessor from "svelte-preprocess";
let static_files = require('rollup-plugin-static-files');
const isDevelopment = process.env.NODE_ENV === "development";
const plugins = [
svelte({
dev: isDevelopment,
extensions: [".svelte"],
preprocess: sveltePreprocessor(),
emitCss: true,
}),
postcss({
extract: true,
}),
commonjs({ include: "node_modules/**", extensions: [".js"] }),
resolve(),
html2({
template: 'src/index.html',
onlinePath: '.'
}),
static_files({
include: ['./img']
})
];
if (isDevelopment) {
plugins.push(
serve({
contentBase: "./docs",
open: false,
host: '0.0.0.0',
port: 1523 // WSL: 1522 (SSH) ~ 1528 is opened for test.
}),
livereload({ watch: "./src", port: 1524 })
);
} else {
plugins.push(terser({ sourcemap: true }));
}
module.exports = {
input: "src/index.js",
output: {
file: "docs/index.js",
sourcemap: true,
format: "iife",
},
plugins,
};