-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
rollup.config.js
65 lines (64 loc) · 1.55 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
import glob from 'glob';
import { filter } from './underscore-esm.js';
import { outputConf, sourcemapConf, monolithConf } from './rollup.common.js';
export default [
// Monolithic ESM bundle for browsers and deno.
{
input: 'modules/index-all.js',
treeshake: false,
output: monolithConf({
file: 'underscore-esm.js',
format: 'esm',
}),
},
// Monolithic UMD bundle for browsers, AMD and old Node.js.
{
input: 'modules/index-default.js',
treeshake: false,
output: monolithConf({
file: 'underscore-umd.js',
exports: 'default',
format: 'umd',
name: '_',
amd: {
id: 'underscore',
},
noConflict: true,
}),
},
// Custom builds for Node.js, first pass. Second pass in rollup.config2.js.
{
input: {
'underscore-node-cjs-pre': 'modules/index-default.js',
'underscore-node-mjs-pre': 'modules/index-all.js',
},
treeshake: false,
output: sourcemapConf({
chunkFileNames: 'underscore-node-f-pre.js',
dir: '.',
minifyInternalExports: false,
format: 'esm',
}),
},
// AMD and CJS versions of the individual modules for development
// and custom bundles.
{
input: filter(
glob.sync('modules/**/*.js'),
function(path) { return path !== 'modules/index-all.js'; }
),
preserveModules: true,
output: [
outputConf({
dir: 'amd',
exports: 'auto',
format: 'amd',
}),
outputConf({
dir: 'cjs',
exports: 'auto',
format: 'cjs',
}),
],
}
];