UNPKG

1.07 kBJavaScriptView Raw
1import nodeResolve from "@rollup/plugin-node-resolve";
2import json from "@rollup/plugin-json";
3import terser from "@rollup/plugin-terser";
4import babel from "@rollup/plugin-babel";
5import commonjs from "@rollup/plugin-commonjs";
6
7const config = {
8 input: "dist/install-button.js",
9 output: {
10 dir: "dist/web",
11 format: "module",
12 },
13 external: ["https://www.improv-wifi.com/sdk-js/launch-button.js"],
14 preserveEntrySignatures: false,
15 plugins: [
16 commonjs(),
17 nodeResolve({
18 browser: true,
19 preferBuiltins: false,
20 }),
21 babel({
22 babelHelpers: "bundled",
23 presets: [
24 [
25 "@babel/preset-env",
26 {
27 targets: {
28 // We use unpkg as CDN and it doesn't bundle modern syntax
29 chrome: "84",
30 },
31 },
32 ],
33 ],
34 }),
35 json(),
36 ],
37};
38
39if (process.env.NODE_ENV === "production") {
40 config.plugins.push(
41 terser({
42 ecma: 2019,
43 toplevel: true,
44 format: {
45 comments: false,
46 },
47 })
48 );
49}
50
51export default config;