react-activity-tracker
Version:
A library to track user interactions and API activity in React apps
32 lines (29 loc) • 937 B
JavaScript
// rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
export default {
input: 'src/index.js', // This is the entry file
output: [
{
file: 'dist/index.cjs.js', // CommonJS output for Node
format: 'cjs', // CommonJS
exports: 'named',
},
{
file: 'dist/index.esm.js', // ES Module output
format: 'esm', // ESModule
},
],
plugins: [
resolve(), // Helps Rollup find external modules
commonjs(), // Convert CommonJS to ES6
babel({
exclude: 'node_modules/**', // Exclude node_modules from Babel
presets: ['@babel/preset-react'], // Support JSX and ES6
}),
terser(), // Minifies the code
],
external: ['react'], // Don't bundle react, mark it as external
};