-
-
Save adriancmiranda/6c46c0268b4654d583b395c6e0ad1958 to your computer and use it in GitHub Desktop.
Revisions
-
aleclarson revised this gist
Jan 19, 2021 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ ### Features 🔥 *Blazing fast* builds -
aleclarson revised this gist
Jan 19, 2021 . 1 changed file with 24 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,22 +3,33 @@ import esbuild from 'rollup-plugin-esbuild' const name = require('./package.json').main.replace(/\.js$/, '') const bundle = config => ({ ...config, input: 'src/index.ts', external: id => !/^[./]/.test(id), }) export default [ bundle({ plugins: [esbuild()], output: [ { file: `${name}.js`, format: 'cjs', sourcemap: true, }, { file: `${name}.mjs`, format: 'es', sourcemap: true, }, ], }), bundle({ plugins: [dts()], output: { file: `${name}.d.ts`, format: 'es', }, }), ] -
aleclarson revised this gist
Aug 10, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ > Please [retweet](https://twitter.com/alecdotbiz/status/1291742610374131712) if this helps you! ### Features -
aleclarson revised this gist
Aug 10, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <sup>Please <a href="https://twitter.com/alecdotbiz/status/1291742610374131712">retweet</a> if this helps you!</sup> ### Features 🔥 *Blazing fast* builds -
aleclarson revised this gist
Aug 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ 🔥 *Blazing fast* builds 😇 CommonJS bundle 🌲 `.mjs` bundle ✨ `.d.ts` bundle + type-checking 🧐 Source maps ### Install -
aleclarson revised this gist
Aug 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ 2. Run this in your terminal: ```sh 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 ``` -
aleclarson revised this gist
Aug 7, 2020 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ ```sh pnpm i rollup rollup-plugin-esbuild rollup-plugin-dts -D wget -O rollup.config.js https://gist.github.com/aleclarson/9900ed2a9a3119d865286b218e14d226/raw/rollup.config.js ``` 3. Ensure your `tsconfig.json` contains these values: @@ -27,12 +27,20 @@ } ``` 4. Ensure your `package.json` contains these values (and replace the `my-lib` part): ```json "main": "dist/my-lib.js", "module": "dist/my-lib.mjs", "typings": "dist/my-lib.d.ts", ``` 5. Change the `input: 'src/index.ts'` line in `rollup.config.js` if needed. 6. All done! Now do `yarn rollup -c` to build, or add this to your `package.json`: ```json "scripts": { "build": "rollup -c" } ``` -
aleclarson created this gist
Aug 7, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ ### Features 🔥 *Blazing fast* builds 😇 CommonJS bundle 🌲 `.mjs` bundle ✨ `.d.ts` bundle 🧐 Source maps ### Install 1. Install [`pnpm`] or replace the `pnpm i` part with Yarn or NPM. [`pnpm`]: https://github.com/pnpm/pnpm#readme 2. Run this in your terminal: ```sh pnpm i rollup rollup-plugin-esbuild rollup-plugin-dts -D wget -O rollup.config.js ... ``` 3. Ensure your `tsconfig.json` contains these values: ```json "compilerOptions": { "target": "esnext" } ``` 4. Ensure your `package.json` contains these values: ```json "main": "dist/my-lib.js", "module": "dist/my-lib.mjs", "typings": "dist/my-lib.d.ts", ``` 5. Change the `input: 'src/index.ts'` line in `rollup.config.js` if needed. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import dts from 'rollup-plugin-dts' import esbuild from 'rollup-plugin-esbuild' const name = require('./package.json').main.replace(/\.js$/, '') const ext = format => format == 'dts' ? 'd.ts' : format == 'cjs' ? 'js' : 'mjs' const bundle = format => ({ input: 'src/index.ts', output: { file: `${name}.${ext(format)}`, format: format == 'cjs' ? 'cjs' : 'es', sourcemap: format != 'dts', }, plugins: format == 'dts' ? [dts()] : [esbuild()], external: id => !/^[./]/.test(id), }) export default [ bundle('es'), // bundle('cjs'), bundle('dts'), ]