-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.ci.config.js
41 lines (37 loc) · 1.47 KB
/
rollup.ci.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
import { plugins, VERSION } from './rollup.common.js';
import terser from '@rollup/plugin-terser';
export default env => {
const fileName = (outputSuffix, version) => `split-browser-${env.branch !== 'main' ? 'dev-' + version : version}${outputSuffix ? '.' + outputSuffix : ''}`;
const createRollupConfig = (input, outputSuffix) => ({
input,
output: [
// development build
{
format: 'umd', // works as `cjs`, `iife` and `amd` all in one
name: 'splitio',
file: `umd/${fileName(outputSuffix, VERSION)}.js`
},
// production build
{
format: 'umd',
name: 'splitio',
file: `umd/${fileName(outputSuffix, VERSION)}.min.js`,
plugins: [
terser()
]
}
],
plugins
});
return [
/**
* Using ES modules as input to avoid transpiling TS files, because it speeds up the build, but also because Rollup plugins like
* https://www.npmjs.com/package/@rollup/plugin-typescript or https://www.npmjs.com/package/rollup-plugin-typescript2
* don't compile .ts files in node_modules, like Webpack ts-loader does (https://github.com/TypeStrong/ts-loader#allowtsinnodemodules)
*
* Only https://www.npmjs.com/package/rollup-plugin-ts compiles from node_modules, and is used for tests.
*/
createRollupConfig('esm/full/umd.js', 'full'), // umd/split-browser-VERSION.full[.min].js
createRollupConfig('esm/umd.js') // umd/split-browser-VERSION[.min].js
];
};