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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@js-toolkit/build-utils

v1.0.1

Published

Build configuration utilities for Webpack, Babel, PostCSS, and project paths

Readme

@js-toolkit/build-utils

npm license

Build configuration utilities for Webpack, Babel, PostCSS, Stylelint, and project environment.

Install

pnpm add -D @js-toolkit/build-utils

Modules

| Export | Description | |--------|-------------| | ./appEnv | NODE_ENV and APP_* environment variables for Webpack DefinePlugin | | ./buildConfig | Read build.config.js with project structure (output, web, node, shared) | | ./paths | Resolved project paths based on build.config.js | | ./webpack/web.config | Webpack config for browser builds | | ./webpack/node.config | Webpack config for Node.js builds | | ./webpack/common.config | Shared Webpack config base | | ./babel/env.babelrc | Babel @babel/preset-env config | | ./babel/react.babelrc | Babel React preset config | | ./babel/ts.env.babelrc | Babel TypeScript + env config | | ./babel/ts.react.babelrc | Babel TypeScript + React config | | ./css/postcssConfig | PostCSS config | | ./css/stylelintrc | Stylelint config | | ./eslint/universal | ESLint config combining common + web with build paths |

Usage

App Environment

import appEnv from '@js-toolkit/build-utils/appEnv';

appEnv.dev;   // NODE_ENV === 'development'
appEnv.prod;  // NODE_ENV === 'production'
appEnv.test;  // NODE_ENV === 'test' || APP_TEST

appEnv.ifDev('dev-value', 'prod-value');
appEnv.ifProd('prod-value', 'dev-value');

// Custom APP_* variables from process.env
appEnv.raw.APP_API_URL;

// For Webpack DefinePlugin
appEnv.envStringify(); // { 'process.env': { NODE_ENV: '"development"', ... } }

Build Config

Create build.config.js in your project root:

module.exports = {
  output: { root: 'dist' },
  web: {
    root: 'web',
    sources: ['src'],
    assets: ['src/assets'],
    staticContent: ['public'],
    tsconfig: 'tsconfig.json',
    output: { root: 'web', js: 'js' },
  },
};
import { getBuildConfig, resolveConfigPath } from '@js-toolkit/build-utils/buildConfig';

const config = getBuildConfig();
config.envStringify(); // { 'process.env.buildConfig': '...' }

Paths

import { getPaths } from '@js-toolkit/build-utils/paths';

const paths = getPaths();
paths.root;                // project root (cwd)
paths.web.sources;         // resolved web source directories
paths.web.output.root;     // resolved web output directory
paths.node.output.root;    // resolved node output directory
paths.getNodeModulesRoot('react'); // path to react in node_modules

Webpack

import { createWebConfig } from '@js-toolkit/build-utils/webpack/web.config';
import { createNodeConfig } from '@js-toolkit/build-utils/webpack/node.config';

const webConfig = createWebConfig({ /* options */ });
const nodeConfig = createNodeConfig({ /* options */ });

Babel

// babel.config.js
import reactBabelrc from '@js-toolkit/build-utils/babel/react.babelrc';
import tsReactBabelrc from '@js-toolkit/build-utils/babel/ts.react.babelrc';

export default tsReactBabelrc;

CSS

import postcssConfig from '@js-toolkit/build-utils/css/postcssConfig';
import stylelintrc from '@js-toolkit/build-utils/css/stylelintrc';

ESLint (Universal)

Build-aware ESLint config that uses build.config.js paths:

// eslint.config.js
import { create } from '@js-toolkit/build-utils/eslint/universal';

export default create();

build.config.js Structure

| Key | Description | |-----|-------------| | output.root | Output directory (default: build) | | web | Web app config: root, sources, assets, staticContent, tsconfig, output | | node | Node app config: root, sources, tsconfig, output | | shared | Shared code: root, sources, tsconfig |

License

MIT