forked from telerik/kendo-ui-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.modules.config.js
57 lines (54 loc) · 1.54 KB
/
rollup.modules.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
import { files, cultures, messages, addKendoVersion, baseOptions, externals, removeBundle, root } from './rollup.config';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import polyfill from 'rollup-plugin-polyfill';
/**
* @type {import('rollup').RollupOptions}
*/
const resourcesConfig = (name, options = {}) => ({
input: `${root}/${name}`,
output: [{
format: "esm",
dir: `./dist/esm/${options.dir}`,
sourcemap: false,
...baseOptions
},{
format: "cjs",
dir: `./dist/cjs/${options.dir}`,
sourcemap: false,
...baseOptions
}],
external: ['../kendo.core.js'],
treeshake: false,
plugins: [
addKendoVersion(),
polyfill(['../kendo.core.js'])
]
});
// rollup.config.js
/**
* @type {import('rollup').RollupOptions}
*/
const configMap = (name) => ({
input: `${root}/${name}`,
output: [{
format: 'esm',
dir: './dist/esm',
sourcemap: false,
...baseOptions
}, {
format: 'cjs',
dir: './dist/cjs',
sourcemap: false,
...baseOptions
}],
external: externals.filter(removeBundle(name)),
treeshake: false,
plugins: [
addKendoVersion(),
name === 'kendo.core.js' ? polyfill(['jquery']) : null,
nodeResolve(),
]
});
export default files.map((name) => configMap(name))
.concat(cultures.map((name) => resourcesConfig(name, { dir: 'cultures' })))
.concat(messages.map((name) => resourcesConfig(name, { dir: 'messages' })));