-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.package.mjs
64 lines (60 loc) · 1.54 KB
/
rollup.config.package.mjs
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
import internalDel from 'del';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import cleanup from 'rollup-plugin-cleanup';
let earlyDelDone = false;
// Runs sequentially before buildStart hooks:
function earlyDel(targets = [], deleteOptions = {}) {
return {
name: 'earlydel',
options: function(options) {
if (!earlyDelDone) {
earlyDelDone = true;
const paths = internalDel.sync(targets, deleteOptions);
if (deleteOptions.verbose) {
console.log(`Deleted files and folders: ${paths.length}`);
if (paths.length > 0) {
paths.forEach((path) => {
console.log(path);
});
}
}
}
return null;
},
};
}
const BANNER_MSG = `/*
* DO NOT EDIT: Auto-generated bundle from sources in ./src
* For easier debugging you can include ./src/index.js directly instead
*/`;
const OUTPUT_FILE = 'dist/index.js';
export default [{
input: `src/index.js`,
output: {
file: OUTPUT_FILE,
format: 'esm',
banner: `/* eslint-disable */\n// @ts-nocheck\n\n${BANNER_MSG}\n\n`,
},
plugins: [
earlyDel([OUTPUT_FILE]),
resolve({modulesOnly: true, preferBuiltins: true}),
commonjs(),
cleanup({
comments: 'sources',
}),
],
external: [
'../../settings.js',
'@derhuerst/http-basic',
'@derhuerst/http-basic/lib/FileCache.js',
'@rollup/pluginutils',
'adm-zip',
'env-paths',
'https-proxy-agent',
'magic-string',
'progress',
'glslify',
],
},
];