2.0.3 • Published 9 months ago

@alwatr/nano-build v2.0.3

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
9 months ago

Nano build

Build/bundle tools for ECMAScript, TypeScript, and JavaScript libraries. It's easy to use, doesn't require any setup, and adheres to best practices. It has no dependencies and uses esbuild for enhanced performance.

Installation

yarn add -D @alwatr/nano-build

Usage

Add the following scripts to your package.json:

{
  "scripts": {
    "build": "nano-build --preset=module",
    "watch": "yarn run build --watch"
  }
}

Presets

default

{
  entryPoints: ['src/main.ts'],
  outdir: 'dist',
  logLevel: 'info',
  target: 'es2020',
  minify: true,
  treeShaking: false,
  sourcemap: true,
  sourcesContent: true,
  bundle: true,
  splitting: false,
  charset: 'utf8',
  legalComments: 'none',
  banner: {
    js: "/* @package_name v@package_version */"
  },
  define: {
    __package_version__: `'@package_version'`,
  },
}

--preset=module

{
  ...defaultPreset,
  platform: 'node',
  format: 'esm',
  cjs: true,
  mangleProps: '__$',
  packages: 'external',
}

--preset=pwa

{
  ...defaultPreset,
  platform: 'browser',
  format: 'iife',
  mangleProps: '_$',
  treeShaking: true,
  sourcemap: false,
  sourcesContent: false,
  target: [
    'es2018',
    'chrome62',
    'edge79',
    'firefox78',
    'safari11',
  ],
}

--preset=pmpa

{
  ...defaultPreset,
  entryPoints: ['site/_ts/*.ts'],
  outdir: 'dist/es',
  platform: 'browser',
  format: 'iife',
  mangleProps: '_$',
  treeShaking: true,
  sourcemap: false,
  sourcesContent: false,
  target: [
    'es2018',
    'chrome62',
    'edge79',
    'firefox78',
    'safari11',
  ],
}

--preset=microservice

{
  ...defaultPreset,
  platform: 'node',
  format: 'esm',
  treeShaking: true,
  mangleProps: '_$',
  sourcemap: false,
  sourcesContent: false,
  target: 'node20',
}

Configuration

Add 'nano-build' field to your package.json for overwriting configuration:

{
  "nano-build": {
    "bundle": true
  },
  "nano-build-development": {
    "minify": false,
    "sourcemap": true
  },
  "nano-build-production": {
    "minify": true,
    "sourcemap": false
  }
}
2.0.3

9 months ago

1.6.0

9 months ago

1.5.0

9 months ago

1.4.0

9 months ago

2.0.2

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.3.10

10 months ago

1.3.9

10 months ago

1.3.8

10 months ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.2.1

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago