forked from grubersjoe/react-activity-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
56 lines (54 loc) · 1.52 KB
/
rollup.config.mjs
File metadata and controls
56 lines (54 loc) · 1.52 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
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import copy from 'rollup-plugin-copy';
import filesize from 'rollup-plugin-filesize';
import external from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
import { visualizer } from 'rollup-plugin-visualizer';
const extensions = ['.ts', '.tsx'];
export default {
input: 'src/index.tsx',
output: {
file: 'build/index.js',
format: 'cjs',
sourcemap: true,
exports: 'named',
// Use 'auto' instead of 'default' for better interoperability with CRA etc.
// https://rollupjs.org/guide/en/#outputinterop
interop: 'auto',
// Rollup does not support this React Server Components directive yet:
// https://github.com/rollup/rollup/issues/4699
banner: `'use client';`,
},
plugins: [
// Add commonjs() from @rollup/plugin-commonjs here and comment out the
// external to see the real bundle size.
external({
includeDependencies: true,
}),
postcss({
modules: true,
}),
babel({
extensions,
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}),
resolve({
extensions,
}),
copy({
targets: [{ src: 'src/*.d.ts', dest: 'build/' }],
}),
filesize(),
visualizer({
filename: 'bundle.html',
}),
],
onwarn(warning, warn) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes('use client')) {
return; // ignore the error for now
}
warn(warning);
},
};