npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@alwatr/nano-build

v6.3.9

Published

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.

Readme

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

First, install @alwatr/nano-build as a development dependency:

yarn add -D @alwatr/nano-build

Usage

Add the following scripts to your package.json to use @alwatr/nano-build:

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

Then run the following command to build your project:

yarn run build

Configuration

TypeScript types

import type {} from '@alwatr/nano-build';

Overwriting 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
  }
}

Presets

Presets are predefined configurations that can be used to build your project. You can use the --preset flag to specify a preset.

yarn run build --preset=module

default

{
  entryPoints: ['src/*.ts'],
  outdir: 'dist',
  logLevel: 'info',
  target: 'es2020',
  minify: true,
  minifyWhitespace: true,
  treeShaking: true,
  sourcemap: false,
  sourcesContent: false,
  bundle: true,
  charset: 'utf8',
  legalComments: 'linked',
  define: {
    __package_name__: packageJson.name,
    __package_version__: packageJson.version,
    __dev_mode__: process.env.NODE_ENV !== 'production',
  },
  banner: {
    js: "/* __package_name__ v__package_version__ */"
  },
}

--preset=module

Builds and bundle for single export module.

{
  ...defaultPreset,
  entryPoints: ['src/main.ts'],
  bundle: true,
  platform: 'node',
  format: 'esm',
  minify: false,
  cjs: true,
  packages: 'external',
  sourcemap: true,
  sourcesContent: true
}

Note: default production overwrite options not applied.

--preset=module2

Builds and bundles multiple entry points in root of src directory for multiple exports module.

{
  ...defaultPreset,
  entryPoints: ['src/*.ts'],
  bundle: true,
  platform: 'node',
  format: 'esm',
  minify: false,
  cjs: true,
  packages: 'external',
  sourcemap: true,
  sourcesContent: true
}

Note: default production overwrite options not applied.

--preset=module3

Builds multiple entry points in src directory for multiple exports module without bundling.

{
  ...defaultPreset,
  entryPoints: ['src/**/*.ts'],
  bundle: false,
  platform: 'node',
  format: 'esm',
  minify: false,
  cjs: true,
  packages: 'external',
  sourcemap: true,
  sourcesContent: true
}

Note: default production overwrite options not applied.

--preset=pwa

{
  ...defaultPreset,
  entryPoints: ['site/_ts/*.ts'],
  outdir: 'dist/es',
  platform: 'browser',
  format: 'iife',
  mangleProps: '_$',
  target: [
    'es2018',
    'chrome62',
    'edge79',
    'firefox78',
    'safari11',
  ],
  ...(devMode ? developmentOverwriteOptions : productionOverwriteOptions),
}

--preset=weaver

{
  ...defaultPreset,
  entryPoints: ['src/ts/*.ts'],
  outdir: 'dist/es',
  platform: 'browser',
  format: 'iife',
  mangleProps: '_$',
  target: [
    'es2018',
    'chrome62',
    'edge79',
    'firefox78',
    'safari11',
  ],
  ...(devMode ? developmentOverwriteOptions : productionOverwriteOptions),
}

--preset=microservice

{
  ...defaultPreset,
  entryPoints: ['src/ts/main.ts'],
  platform: 'node',
  format: 'esm',
  mangleProps: '_$',
  target: 'node20',
  ...(devMode ? developmentOverwriteOptions : productionOverwriteOptions),
}

--preset=pmpa

{
  ...defaultPreset,
  entryPoints: ['site/_ts/*.ts'],
  outdir: 'dist/es',
  platform: 'browser',
  format: 'iife',
  mangleProps: '_$',
  target: [
    'es2018',
    'chrome62',
    'edge79',
    'firefox78',
    'safari11',
  ],
  ...(devMode ? developmentOverwriteOptions : productionOverwriteOptions),
}

Development overwrite

This preset is used when NODE_ENV is not set to production. It overwrites all other presets.

{
  sourcemap: true,
  sourcesContent: true,
}

you can also add nano-build-development field to your package.json for overwriting configuration.

Production overwrite

This preset is used when NODE_ENV is set to production. It overwrites all other presets.

{
  dropLabels: ['__dev_mode__'];
}

you can also add nano-build-production field to your package.json for overwriting configuration.

Sponsors

The following companies, organizations, and individuals support Nanolib ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.

Contributing

Contributions are welcome! Please read our contribution guidelines before submitting a pull request.