-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
39 lines (35 loc) · 989 Bytes
/
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
import clear from "rollup-plugin-clear";
import copy from "rollup-plugin-copy";
import json from "@rollup/plugin-json";
import resolve from "@rollup/plugin-node-resolve";
// Both inputs will use the same output settings
const commonOutput = {
dir: "dist",
format: "esm",
sourcemap: true,
};
// Both inputs use these plugin settings
const commonPlugins = [clear({ targets: ["dist"] }), json(), resolve()];
// Return the arguments for `rollup-plugin-copy`
const copyArgs = (filename) => {
return {
targets: [
{ src: `src/${filename}.html`, dest: "dist" },
{ src: `src/${filename}.css`, dest: "dist" },
],
};
};
export default [
{
// Output for the user-facing page
input: "src/client.js",
output: commonOutput,
plugins: [...commonPlugins, copy(copyArgs("client"))],
},
{
// Output for the puppeteer page
input: "src/puppeteer.js",
output: commonOutput,
plugins: [...commonPlugins, copy(copyArgs("puppeteer"))],
},
];