Skip to content
mkbuild / 1.0.0-alpha.20

mkbuild 1.0.0-alpha.20

Install from the command line:
Learn more about npm packages
$ npm install @flex-development/mkbuild@1.0.0-alpha.20
Install via package.json:
"@flex-development/mkbuild": "1.0.0-alpha.20"

About this version

mkbuild

github release npm codecov module type: esm license conventional commits typescript vitest yarn

An esbuild based file-to-file transformer and bundler.

Contents

Features

πŸ“¦ optimized bundler and transpiler

fast and minimal builds with esbuild (integrates with the build api for plugin support β€” say toodles πŸ‘‹πŸΎ to transform api hacks! πŸ˜‰)

πŸ“ bundleless dists

create bundleless distributions with file-to-file transpilation and static asset copying

😌 esm friendly

create es modules + add file extensions to specifiers in modules and declaration files

πŸ“‘ dts generation (.d.cts, .d.mts, .d.ts)

generate declarations for .cjs, .cts, .js, .jsx, .mjs, .mts, .ts, and .tsx files

🧬 path alias support

resolve path aliases in .cjs, .cts, .d.cts, .d.mts, .d.ts, .js, .jsx, .mjs, .mts, .ts, and .tsx files

Install

This package is ESM only.

yarn add -D @flex-development/mkbuild esbuild typescript

From Git:

yarn add -D @flex-development/mkbuild@flex-development/mkbuild esbuild typescript
See Git - Protocols | Yarn Β for details on requesting a specific branch, commit, or tag.

Use

mkbuild

Running the command above without a build configuration file will create a bundleless esm build with declarations.

Files within the src directory will be transpiled or copied and output to dist/**.{d.mts,mjs}. Declaration files, dist/**.d.mts, will be generated if typescript is installed. The original folder structure and extensions of copied files will remain in tact.

Configuration

Create build.config.{cjs,cts,js,json,mjs,mts,ts}:

/**
 * @file Build Config
 * @module config/build
 */

import { defineBuildConfig } from '@flex-development/mkbuild'

export default defineBuildConfig({
  // esbuild options; see https://esbuild.github.io/api/#build-api
  sourcemap: 'external',
  sourcesContent: false,
  treeShaking: true,
  tsconfig: 'tsconfig.build.json'
})

See all configuration options here.

Options common to build configs and build entries can be seen here.

Configuring Build Entries

/**
 * @file Build Config
 * @module config/build
 */

import { defineBuildConfig } from '@flex-development/mkbuild'
import pkg from './package.json' assert { type: 'json' }

export default defineBuildConfig({
  entries: [
    { dts: true, ignore: ['cli.ts'] }, // dist/**.{d.mts,mjs}
    { dts: true, ext: '.cjs', format: 'cjs', ignore: ['cli.ts'] }, // dist/**.{cjs,d.cts}
    { dts: 'only', ext: '.js', ignore: ['cli.ts'] }, // dist/**.d.ts
    { bundle: true, minify: true, source: 'src/cli.ts' } // dist/cli.mjs
  ],
  platform: 'node',
  sourcemap: 'external',
  sourcesContent: false,
  target: 'node' + pkg.engines.node.replace(/^\D+/, ''),
  treeShaking: true,
  tsconfig: 'tsconfig.build.json'
})

See all build entry options here.

Types

This package is fully typed with TypeScript.

Contribute

See CONTRIBUTING.md.

Details


Assets

  • mkbuild-1.0.0-alpha.20.tgz

Download activity

  • Total downloads 10,078
  • Last 30 days 0
  • Last week 0
  • Today 0