rollup.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. var rollupBabel = require('rollup-plugin-babel');
  2. var baseConfig = {
  3. external: ['jquery'],
  4. plugins: [
  5. rollupBabel({
  6. presets: [
  7. ["@babel/preset-env", { modules: false }]
  8. ],
  9. }),
  10. ],
  11. };
  12. module.exports = [
  13. // UMD
  14. // Compatible with most environments and tools (AMD, CJS, ESM...),
  15. // > Generated with Webpack. See the "javascript:foundation" gulp task.
  16. // > TODO: factorize the assets generation.
  17. // CommonJS
  18. // For older bundlers like Browserify or Webpack 1.
  19. Object.assign({}, baseConfig, {
  20. input: './js/foundation.js',
  21. output: {
  22. exports: 'named',
  23. format: 'cjs',
  24. file: './dist/js/foundation.cjs.js',
  25. sourcemap: true,
  26. }
  27. }),
  28. // ES Modules
  29. // For modern bundlers like Webpack 2+ or Rollup that will use ES Modules
  30. // via static analysis to make some tree shaking.
  31. Object.assign({}, baseConfig, {
  32. input: './js/foundation.js',
  33. output: {
  34. exports: 'named',
  35. format: 'es',
  36. file: './dist/js/foundation.esm.js',
  37. sourcemap: true,
  38. }
  39. }),
  40. // ES6
  41. // Non-transpiled ES modules for those who want to transpile their code with
  42. // their own configuration (e.g. for custom targets).
  43. Object.assign({}, baseConfig, {
  44. input: './js/foundation.js',
  45. plugins: [], // No babel transpilation
  46. output: {
  47. exports: 'named',
  48. format: 'es',
  49. file: './dist/js/foundation.es6.js',
  50. sourcemap: true,
  51. }
  52. }),
  53. ];