-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
62 lines (58 loc) · 1.48 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
'use strict';
const { builtinModules } = require('module');
const { resolve } = require('path');
const RollupPluginTypescript = require('@wessberg/rollup-plugin-ts');
const RollupPluginNodeResolve = require('rollup-plugin-node-resolve');
const RollupPluginCommonJs = require('rollup-plugin-commonjs');
const { terser } = require('rollup-plugin-terser');
const Typescript = require('typescript');
const pkg = require('./package.json');
module.exports = [
{
input: resolve(__dirname, 'src/index.ts'),
output: [
{
name: 'Velcro',
extend: true,
file: resolve(__dirname, pkg.unpkg),
format: 'umd',
},
],
plugins: [
RollupPluginNodeResolve({ extensions: ['.mjs', '.js'] }),
RollupPluginCommonJs(),
RollupPluginTypescript({
tsconfig: {
target: Typescript.ScriptTarget.ES2015,
},
}),
terser({
mangle: {
reserved: ['Velcro'],
},
}),
],
},
{
input: resolve(__dirname, 'src/index.ts'),
output: [
{
file: resolve(__dirname, pkg.main),
format: 'cjs',
sourcemap: true,
},
{
file: resolve(__dirname, pkg.browser),
format: 'cjs',
sourcemap: true,
},
{
file: resolve(__dirname, pkg.module),
format: 'esm',
sourcemap: true,
},
],
external: [...Object.keys(pkg.dependencies), ...builtinModules],
plugins: [RollupPluginTypescript({})],
},
];