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