-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathrollup.config.js
76 lines (74 loc) · 1.69 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
70
71
72
73
74
75
76
import { terser } from "rollup-plugin-terser";
import babel from "@rollup/plugin-babel";
import filesize from "rollup-plugin-filesize";
import livereload from "rollup-plugin-livereload";
import serve from "rollup-plugin-serve";
import pkg from "./package.json";
const dev = process.env.ROLLUP_WATCH;
const prod = !dev;
const banner = () => `/**!
* Sparticles - ${pkg.description}
* @version ${pkg.version}
* @license ${pkg.license}
* @author ${pkg.author}
* @website ${pkg.homepage}
* @repository ${pkg.repository}
*/
`;
export default [
{
input: "src/sparticles.js",
output: [
{
file: "dist/sparticles.esm.js",
format: "esm",
banner: banner(),
plugins: [filesize()],
},
{
file: "dist/sparticles.mjs",
format: "esm",
banner: banner(),
plugins: [filesize()],
},
{
name: "Sparticles",
file: "dist/sparticles.js",
format: "iife",
banner: banner(),
plugins: [filesize()],
},
{
name: "Sparticles",
file: "dist/sparticles.min.js",
format: "iife",
banner: banner(),
plugins: [prod && terser()],
},
],
plugins: [
babel({
babelrc: false,
exclude: "node_modules/**",
babelHelpers: "bundled",
}),
dev &&
serve({
contentBase: "",
host: "localhost",
openPage: "/example/vanilla/vanilla.html",
port: 5555,
}),
dev && livereload(),
],
watch: {
include: "src/**",
chokidar: {
usePolling: true,
interval: 2000,
binaryInterval: 2000,
},
buildDelay: 1000,
},
},
];