Socket
Socket
Sign inDemoInstall

webpack-cli

Package Overview
Dependencies
134
Maintainers
5
Versions
123
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    webpack-cli

CLI for webpack & friends


Version published
Weekly downloads
6M
decreased by-9.29%
Maintainers
5
Install size
1.38 MB
Created
Weekly downloads
 

Package description

What is webpack-cli?

The webpack-cli npm package provides a command-line interface for the webpack bundler, which allows developers to interact with webpack and its features directly from the command line. It enables tasks such as creating a new webpack project, managing configurations, running the development server, and more.

What are webpack-cli's main functionalities?

Initializing a new webpack project

This command sets up a new webpack project by generating a default configuration file. It can also install webpack and related dependencies if they are not already installed.

webpack-cli init

Generating a configuration file

Generates a webpack configuration file based on the user's preferences. It can be used to quickly scaffold a new configuration or to update an existing one.

webpack-cli generate

Running a webpack build

Executes the webpack build process, which bundles the source files according to the webpack configuration. This is typically used for production builds.

webpack-cli build

Starting a development server

Starts the webpack development server, which provides a live reloading environment for development purposes. It watches for file changes and automatically recompiles the project.

webpack-cli serve

Running webpack in watch mode

Runs webpack in watch mode, where it watches for file changes and recompiles the project as necessary. This is useful during development to see changes reflected immediately.

webpack-cli watch

Other packages similar to webpack-cli

Changelog

Source

4.4.0 (2021-01-19)

Bug Fixes

  • better description for --no-watch-options-stdin (#2288) (4ee8665)
  • double commands output in help (#2298) (efe81e9)
  • pass all argv to configurations when serve command used (#2345) (5070b9b)
  • respect --stats, --color and --no-color option for serve command (#2312) (73d3fec)
  • show exact package name while prompting for installation (#2338) (ffc93e5)
  • webpack installation prompt message (#2316) (3659c5e)

Features

Readme

Source

webpack CLI

The official CLI of webpack

About

webpack CLI provides a flexible set of commands for developers to increase speed when setting up a custom webpack project. As of webpack v4, webpack is not expecting a configuration file, but often developers want to create a more custom webpack configuration based on their use-cases and needs. webpack CLI addresses these needs by providing a set of tools to improve the setup of custom webpack configuration.

How to install

When you have followed the Getting Started guide of webpack then webpack CLI is already installed!

Otherwise

npm install --save-dev webpack-cli

or

yarn add webpack-cli --dev

Supported arguments and commands

Usage

All interactions with webpack-cli are of the form

npx webpack-cli [command] [options]

If no command is specified then bundle command is used by default

Help Usage

You display basic commands and arguments -

npx webpack-cli --help

To display all supported commands and arguments -

npx webpack-cli --help=verbose

or

npx webpack-cli --help verbose

Available Commands

  bundle | b      Run webpack
  help | h        Display help for commands and options
  version | v     Output version number of the 'webpack', 'webpack-cli' and other related packages
  init | c        Initialize a new webpack configuration
  migrate | m     Migrate a configuration to a new version
  loader | l      Scaffold a loader repository
  plugin | p      Scaffold a plugin repository
  info | i        Outputs information about your system and dependencies
  serve | s       Run the webpack Dev Server
  configtest | t  Tests webpack configuration against validation errors.

webpack 4

  --analyze                     It invokes webpack-bundle-analyzer plugin to get bundle information
  --entry string[]              The entry point(s) of your application.
  -c, --config string[]         Provide path to webpack configuration file(s)
  --config-name string[]        Name of the configuration to use
  -m, --merge                   Merge several configurations using webpack-merge
  --progress string, boolean    Print compilation progress during build
  --color                       Enables colors on console
  --no-color                    Disable colors on console
  --env string[]                Environment passed to the configuration when it is a function
  --name string                 Name of the configuration. Used when loading multiple configurations
  --help                        Outputs list of supported flags
  -o, --output-path string      Output location of the generated bundle
  -t, --target string[]         Sets the build target
  -w, --watch                   Watch for files changes
  --no-watch                    Do not watch for file changes
  -h, --hot                     Enables Hot Module Replacement
  --no-hot                      Disables Hot Module Replacement
  -d, --devtool string          Controls if and how source maps are generated.
  --no-devtool                  Do not generate source maps
  --prefetch string             Prefetch this request
  -j, --json string, boolean    Prints result as JSON or store it in a file
  --mode string                 Defines the mode to pass to webpack
  -v, --version                 Get current version
  --stats string, boolean       It instructs webpack on how to treat the stats
  --no-stats                    Disables stats output

webpack 5

Checkout OPTIONS.md to see list of all available options.

Keywords

FAQs

Last updated on 19 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc