1
0

rollup.config.mjs 1.0 KB

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