-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
executable file
·70 lines (62 loc) · 1.93 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
61
62
63
64
65
66
67
68
69
70
import { relative, isAbsolute, dirname } from 'path';
import babel from 'rollup-plugin-babel';
import rebase from 'rollup-plugin-rebase';
import cjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import jsonPlugin from 'rollup-plugin-json';
const entry = 'src/index.js';
var fileRebase = rebase({
outputFolder: dirname('lib/babelPresetBoldr.cjs.js'),
input: entry,
verbose: true,
});
export default {
input: entry,
sourcemap: true,
name: 'babelPresetBoldr',
output: {
file: 'lib/babelPresetBoldr.cjs.js',
format: 'cjs',
},
external(dependency) {
if (dependency === entry) {
return false;
}
if (fileRebase.isExternal(dependency)) {
return true;
}
if (isAbsolute(dependency)) {
var relativePath = relative(__dirname, dependency);
return Boolean(/node_modules/.exec(relativePath));
}
return dependency.charAt(0) !== '.';
},
plugins: [
babel({
babelrc: false,
runtimeHelpers: false,
// Remove comments - these are often positioned on the wrong positon after transpiling anyway
comments: false,
// Do not include superfluous whitespace characters and line terminators.
// When set to "auto" compact is set to true on input sizes of >500KB.
compact: true,
// Should the output be minified (not printing last semicolons in blocks, printing literal string
// values instead of escaped ones, stripping () from new when safe)
minified: true,
exclude: 'node_modules/**',
presets: [['env', { modules: false, targets: { node: '6.11.1' }, useBuiltIns: true }]],
plugins: [['transform-object-rest-spread', { useBuiltIns: true }]],
}),
cjs({
include: ['node_modules/**'],
}),
nodeResolve({
extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
jsnext: true,
module: true,
main: true,
}),
jsonPlugin(),
fileRebase,
],
};