-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
43 lines (43 loc) · 1.28 KB
/
rollup.config.js
File metadata and controls
43 lines (43 loc) · 1.28 KB
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
const terser=require('@rollup/plugin-terser');
const commonjs=require('@rollup/plugin-commonjs');
const nodeResolve=require('@rollup/plugin-node-resolve');
const pkg = require('./package.json');
const Config = ({en, inputPath = '', outputFile = 'tabs-more-button', outputName = 'tabsMoreButton', pf = false}) => {
var pfName = pf ? '.including-polyfills' : '';
return {
input: `lib/${pf ? 'esm-including-polyfills' : 'esm'}/${inputPath}api.js`,
output: {
file: `dist/${outputFile}${en === 'dev' ? '' : '.min'}.js`,
format: 'umd',
name: outputName,
sourcemap: true,
banner:
'' +
`/**
* ${pkg.name} - ${pkg.description}
*
* @version v${pkg.version}
* @homepage ${pkg.homepage}
* @author ${pkg.author.name} ${pkg.author.email}
* @license ${pkg.license}
*/`,
},
plugins: (function () {
const _plugins = [
nodeResolve({
// preferBuiltins: false
}),
commonjs(),
];
if (en === 'prod') {
_plugins.push(terser());
}
return _plugins;
})(),
external: function (id) {
return /.test.js$/g.test(id);
},
};
},
ConfigFactory = (op) => [Config({en: 'prod', ...op})];
module.exports = ConfigFactory();