-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrollup.config.js
49 lines (43 loc) · 1.39 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
import pkg from './package.json';
import del from 'rollup-plugin-delete';
import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json';
import copy from 'rollup-plugin-copy';
const config = [
{
input: './src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
globals: {
Cypress: 'cypress',
},
},
{ file: pkg.module, format: 'es' },
],
plugins: [
// Delete contents of target folder
del({
targets: pkg.files,
}),
// Resolve JSON files
json(),
// Compile to commonjs and bundle
commonjs(),
// Copy type definitions to target folder
copy({
targets: [{ src: './types/**/*.d.ts', dest: './dist/types' }],
}),
],
/**
* Mark all dependencies as external to prevent Rollup from
* including them in the bundle. We'll let the package manager
* take care of dependency resolution and stuff so we don't
* have to download the exact same code multiple times, once
* in this bundle and also as a dependency of another package.
*/
external: [...Object.keys(pkg.dependencies || {})],
},
];
module.exports = config;