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

@enmove/conf-webpack

v1.0.0-alpha.3

Published

A webpack configuration generator for web and electron applications.

Readme

@enmove/conf-webpack

A webpack configuration generator for web and electron applications.

Features

  • TypeScript loader
  • css-module support
  • SASS support with TS declaration generation (by typings-for-css-modules-loader)
  • Compatible with webpack-dev-server
  • Automatically generates vendor.js for external packages, which is barely changed

Project structure

This webpack config infers that your project structure is following:

my-project
├── dist
│   ├── (bundle.js + .map)
│   ├── (index.html)
│   ├── (main.css + .map)
│   └── (vendor.js)
├── src
│   ├── index.html  // The html template
│   ├── index.tsx   // The entry file
│   └── ...
├── static
│   └── ...
├── package.json
├── tsconfig.json
└── webpack.config.js

Usage

There are two ways to use this module to create a webpack configuration object:

  • Import a config object from either web or electron directory (recommended)
  • Import a config builder function and call it with options

Import a config object

Importing a config object in your webpack.config.js is the easiest way to use this module.

In your webpack.config.js, import one of presets and export it:

module.exports = require("@enmove/conf-webpack/web");

Notice the /web sub-directory. You have to specify the target of your application to load a webpack config.

If you want to create a webpack config for an electron app (precisely, an electron renderer), import it from electron directory rather than web:

module.exports = require("@enmove/conf-webpack/electron");

Configs for production and development

Some of the attributes in the webpack config may change in response to the webpack mode. For example. those webpack plugins related to hot-reloading should be removed in production mode.

@enmove/conf-webpack automatically detect the current webpack mode by reading the argument that is passed to run webpack. So, we strongly recommend you to call webpack with either --mode=production or --mode=development.

// In package.json
{
    "scripts": {
        "webpack": "webpack --mode production",
        "webpack:dev": "webpack-dev-server --mode development"
    }
}

Sometimes, you want to separate webpack.config.js into multiple profiles like webpack.prod.config.js, and webpack.dev.config.js. In that case, you probably want to avoid auto-detection of the webpack mode by explicitly specifying it.

To do this, import the config from either <target>/prod or <target>/dev like this:

// In `webpack.production.config.js`:
module.exports = require("@enmove/conf-webpack/prod");

// In `webpack.development.config.js`:
module.exports = require("@enmove/conf-webpack/dev");

Customize a webpack config

Since it returns a webpack config object, you can customize it by modifying the returned object:

const config = require("@enmove/conf-webpack/web");

// Modify the config
config.devtool = "eval";

// Don't forget exporting the config
module.exports = config;

Import a config builder function

In the cases where you want to tweak the webpack config generated by this module, use a config builder function instead of the preset configs.

To use the config builder function, import it from exactly @enmove/conf-webpack:

const generateWebpackConfig = require("@enmove/conf-webpack");

// It returns a webpack configuration object
module.exports = generateWebpackConfig({
    // ...options
});

API

Presets

@enmove/conf-webpack provides following presets:

  • @enmove/conf-webpack/web
  • @enmove/conf-webpack/web/prod
  • @enmove/conf-webpack/web/dev
  • @enmove/conf-webpack/electron
  • @enmove/conf-webpack/electron/prod
  • @enmove/conf-webpack/electron/dev

In addition, @enmove/conf-webpack exports the webpack config builder called generateWebpackConfig function.

generateWebpackConfig(config?)

Returns a webpack configuration object.

generateWebpackConfig(config?: Config) => WebpackConfiguration;

Use this function rather than preset configurations to tweak the generated config object for your needs.

All of the attributes in config are optional.

| Key | Type | Default | Description | |------------------|-------------------------------|------------------------------|---------------------------------------------------------------| | rootDir | string | process.cwd() | The project root directory. | | isDev | boolean | Detected from process.argv | Indicates whether the webpack mode is "development" or not. | | target | "web" | "electron-renderer" | "web" | Indicates which platform your app targets. | | vendor.include | string[] | [] | A set of modules that should be bundled into vendor.js. | | vendor.exclude | string[] | [] | A set of modules that should not be bundled into vendor.js. |

config.target

Specifies the webpack target from web (default) or electron-renderer. Useful when you are bundling your electron application.

module.exports = require("@enmove/conf-webpack")({
    target: "electron-renderer"
});

config.vendor

This package extracts the list of packages that are used in the application from the dependencies field in your package.json, and generates vendor.js that contains the bundled code those are unlikely changed because they are external modules.

In the case you need to customize the list of modules that should be bundled in the separeted js file, provide exclude and/or include list, or you can just convert your dependencies into devDependencies so modules in dev dependencies are not bundled in vendor.js or vice versa.

module.exports = require("@enmove/conf-webpack")({
    vendor: {
        exclude: ["bootstrap"]
    }
});

Additional info

This package is included in: