A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://gist.github.com/aleclarson/9900ed2a9a3119d865286b218e14d226 below:

The best Rollup config for TypeScript libraries ยท GitHub

It's 2024. You should use tsup instead of this.

๐Ÿ”ฅ Blazing fast builds
๐Ÿ˜‡ CommonJS bundle
๐ŸŒฒ .mjs bundle
โœจ .d.ts bundle + type-checking
๐Ÿง Source maps

  1. Install pnpm or replace the pnpm i part with Yarn or NPM.
  1. 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
  2. Ensure your tsconfig.json contains these values:

    "compilerOptions": {
      "target": "esnext"
    }
  3. Ensure your package.json contains these values (and replace the my-lib part):

    "main": "dist/my-lib.js",
    "module": "dist/my-lib.mjs",
    "typings": "dist/my-lib.d.ts",
  4. Change the input: 'src/index.ts' line in rollup.config.js if needed.

  5. All done! Now do yarn rollup -c to build, or add this to your package.json:

    "scripts": {
      "build": "rollup -c"
    }

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4