Please retweet if this helps you!
🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs
bundle
✨ .d.ts
bundle + type-checking
🧐 Source maps
- Install
pnpm
or replace thepnpm i
part 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.githubusercontent.com/aleclarson/9900ed2a9a3119d865286b218e14d226/raw/rollup.config.js
-
Ensure your
tsconfig.json
contains these values:"compilerOptions": { "target": "esnext" }
-
Ensure your
package.json
contains these values (and replace themy-lib
part):"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.js
if needed. -
All done! Now do
yarn rollup -c
to build, or add this to yourpackage.json
:"scripts": { "build": "rollup -c" }