forked from Dforrunner/react-qr-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
41 lines (40 loc) · 1.11 KB
/
rollup.config.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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
export default {
input: 'src/index.jsx', // Entry file of your component
output: [
{
file: 'dist/index.js', // CommonJS module format
format: 'cjs',
exports: 'named',
},
{
file: 'dist/index.esm.js', // ES module format
format: 'esm',
},
{
file: 'dist/index.umd.js', // UMD format
format: 'umd',
name: 'YourLibraryName', // Replace with your library's name
globals: {
react: 'React', // External dependencies that are available globally
'react-dom': 'ReactDOM',
jsqr: 'jsQr',
},
},
],
plugins: [
peerDepsExternal(), // Treat peer dependencies as external
resolve({
extensions: ['.js', '.jsx'],
}),
commonjs(),
babel({
exclude: 'node_modules/**',
presets: ['@babel/preset-react'],
}),
],
external: ['react', 'react-dom', 'jsqr'], // Specify external dependencies
};