It's 2024. You should use tsup instead of this.
🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
✨ .d.ts bundle + type-checking
🧐 Source maps
- Install pnpmor replace thepnpm ipart with Yarn or NPM.
- 
Run this in your terminal: pnpm i esbuild rollup rollup-plugin-esbuild rollup-plugin-dts -D wget -O rollup.config.js https://gist.github.com/aleclarson/9900ed2a9a3119d865286b218e14d226/raw/rollup.config.js 
- 
Ensure your tsconfig.jsoncontains these values:"compilerOptions": { "target": "esnext" } 
- 
Ensure your package.jsoncontains these values (and replace themy-libpart):"main": "dist/my-lib.js", "module": "dist/my-lib.mjs", "typings": "dist/my-lib.d.ts", 
- 
Change the input: 'src/index.ts'line inrollup.config.jsif needed.
- 
All done! Now do yarn rollup -cto build, or add this to yourpackage.json:"scripts": { "build": "rollup -c" } 
It seems like rollup-plugin-esbuild would cause build failure when working with rollup 3.
To resolve this issue, use rollup 2 instead.