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