Repository navigation
Expand file tree
/
Copy pathrollup.config.js
More file actions
67 lines (63 loc) · 1.61 KB
/
Copy pathrollup.config.js
File metadata and controls
67 lines (63 loc) · 1.61 KB
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
66
67
import resolve from '@rollup/plugin-node-resolve';
import external from 'rollup-plugin-peer-deps-external';
import commonjs from '@rollup/plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import url from '@rollup/plugin-url';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
const packageJson = require('./package.json');
const globals = {
react: 'React',
'react-dom': 'reactDom',
'react-router-dom': 'reactRouterDom',
jquery: '$'
};
// MUI ships 'use client' directives for React Server Components. Rollup drops
// them when bundling and warns once per file, which buries every other warning
// under roughly 360 lines of noise. Nothing here can act on them, so they are
// dropped and everything else is still reported.
const onwarn = (warning, warn) => {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return;
}
warn(warning);
};
export default [
{
input: './src/index.ts',
onwarn,
output: [
{
file: packageJson.main,
format: 'cjs',
exports: 'auto',
name: 'Cinnamon',
globals
},
{
file: packageJson.module,
format: 'esm',
exports: 'named'
},
{
file: packageJson.unpkg,
format: 'iife',
exports: 'auto',
name: 'Cinnamon',
globals
}
],
plugins: [
external(),
resolve(),
url({
include: ['**/*.otf', '**/*.svg', '**/*.jpg', '**/*.png'],
limit: Infinity
}),
commonjs(),
typescript({ sourceMap: false }),
postcss(),
terser()
]
}
];