forked from instana/weasel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
36 lines (31 loc) · 916 Bytes
/
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
/* eslint-env node */
const replace = require('rollup-plugin-replace');
const babel = require('rollup-plugin-babel');
const path = require('path');
const fs = require('fs');
const isDebugBuild = process.env.NODE_ENV !== 'production';
export default {
input: 'lib/index.js',
output: {
file: `target/${process.env.FILENAME}.js`,
format: 'iife'
},
plugins:[
babel({
babelrc: false,
exclude: 'node_modules/**',
plugins: getPlugins()
}),
replace({
DEBUG: JSON.stringify(isDebugBuild)
})
]
};
function getPlugins() {
const content = fs.readFileSync(path.join(__dirname, '.babelrc'), {encoding: 'utf8'});
const config = JSON.parse(content);
return config.plugins
// Rollup works with commonjs module. If we would transpile them, then rollup
// could not do its job.
.filter(plugin => plugin !== '@babel/plugin-transform-modules-commonjs');
}