-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollupumd.js
35 lines (30 loc) · 843 Bytes
/
rollupumd.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
const {rollup} = require('rollup');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const babel = require('rollup-plugin-babel');
const fs = require('fs');
const babelConfig = JSON.parse(fs.readFileSync('./.babelrc', 'utf8'));
babelConfig.plugins.push('@babel/plugin-proposal-object-rest-spread');
babelConfig.presets.push('@babel/preset-env');
rollup({
input: './src/SelfContained.js',
plugins: [
require('rollup-plugin-replace')({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
babel(babelConfig),
resolve(),
commonjs(),
],
})
.then(bundle => {
return bundle.write({
file: 'Flamegraph-umd.js',
format: 'umd',
name: 'Flamegraph',
});
})
.then(() => {
console.log('done');
process.exit(0);
});