build.js 677 B

123456789101112131415161718192021222324252627282930
  1. import esbuild from "esbuild";
  2. import babel from "esbuild-plugin-babel";
  3. build({
  4. entryPoints: [`builds/cdn.js`],
  5. outfile: `dist/autoanimate.cdn.js`,
  6. plugins: [babel()],
  7. platform: "browser",
  8. define: { CDN: "true" },
  9. });
  10. build({
  11. entryPoints: [`builds/module.js`],
  12. outfile: `dist/autoanimate.esm.js`,
  13. platform: "neutral",
  14. mainFields: ["main", "module"],
  15. });
  16. build({
  17. entryPoints: [`builds/module.js`],
  18. outfile: `dist/autoanimate.cjs.js`,
  19. target: ["node10.4"],
  20. platform: "node",
  21. });
  22. function build(options) {
  23. options.define || (options.define = {});
  24. return esbuild.build({ ...options, minify: true, bundle: true }).catch(() => process.exit(1));
  25. }