π₯ Blazing fast builds
π CommonJS bundle
π² .mjs bundle
β¨ .d.ts bundle + type-checking
π§ Source maps
-
Run this in your terminal:
npm i rollup rollup-plugin-typescript2 typescript tslib -D wget -O rollup.config.js https://gist.githubusercontent.com/asselin/6662c065eec3de21abd243a484823250/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
npm rollup -cto build, or add this to yourpackage.json:"scripts": { "build": "rollup -c" }