1.2.9 • Published 3 years ago
@jsheaven/easybuild v1.2.9
Super-fast and simple IIFE, ESM and CJS bundler for JavaScript and TypeScript. Comes with an easy API and CLI. One file in, one file out. Supports node and browser output. Generates
.mapand.d.tsfiles. Minifies and prints the final code size.
- As a developer, I don't want to configure
esbuildagain and again to gain the same results. - As a developer, I want to have
esbuildconfigured to bundle forbrowserornodeand generateCJS,ESMandIIFElikewise - As a developer, I don't want
esbuildto fail on__dirnameand__filenamenot being defined - As a developer, I don't want
node_modulesto be bundled in when bundlung for Node.js - As a developer, I want to have an API and CLI to simply build one file at a time
- As a developer, I want to see the file sizes raw, gzip and brotli compressed
- ✅ Configures
esbuildto simply generate one output (per module type) JavaScript for one input TypeScript/JavaScript - ✅ Generates
cjs,esmandiifeinvariants automatically - ✅ Full support for
.d.tsbundling and type checking - ✅ Prints the file sizes per compression type
gzipandbrotli, when done - ✅ Just
1849bnano sized (ESM, gizpped) - ✅ Available as CLI and API
- ✅ Fixes several unintuitive
esbuilddefault behaviours - ✅ Runs on Windows, Mac, Linux, CI tested
- ✅ First class TypeScript support
- ✅ 100% Unit Test coverage
For Node.js:
npx @jsheaven/easybuild ./src/index.ts ./dist/index.js node
For browsers:
npx @jsheaven/easybuild ./src/index.ts ./dist/index.js browser
You need at least version 18 of Node.js installed.
- yarn:
yarn add @jsheaven/easybuild - npm:
npm install @jsheaven/easybuild
import { buildForNode, buildForBrowser } from '@jsheaven/easybuild'
await buildForNode({
// source file to build
entryPoint: './src/cli.ts',
// file to generate (actually, generates invariants like ./dist/cli.iife.js, etc.)
outfile: './dist/cli.js',
// allows to disable all minification and tree shaking with one flag
debug: false,
// generated .d.ts files, but drives the build-time and may cause typing errors
dts: true,
// specific configuration for the .d.ts bundle output
dtsOutputOptions: {
exportReferencedTypes: true,
inlineDeclareExternals: true,
inlineDeclareGlobals: true,
noBanner: true,
sortNodes: true,
},
// allows to inline types (.d.ts) of dependent libraries etc.
dtsLibOptions: { ... },
// in case you want to set any extra esbuild options
esBuildOptions: {
// usually, Node.js builds are not bundled, but e.g. for CLIs you want that
bundle: true,
},
})const { buildForNode, buildForBrowser } = require('@jsheaven/easybuild')
// same API like ESM variant1.2.9
3 years ago
1.2.8
3 years ago
1.2.7
3 years ago
1.2.6
3 years ago
1.2.5
3 years ago
1.2.4
3 years ago
1.2.3
3 years ago
1.2.2
3 years ago
1.2.1
3 years ago
1.2.0
3 years ago
1.1.9
3 years ago
1.1.8
3 years ago
1.1.7
3 years ago
1.1.6
3 years ago
1.1.5
3 years ago
1.1.4
3 years ago
1.1.3
3 years ago
1.1.2
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.0
3 years ago
0.0.1
3 years ago