Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
webpack-cli
Advanced tools
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.
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
Parcel is a web application bundler that offers a similar zero-configuration experience to webpack. It focuses on speed and simplicity, with a built-in development server and hot module replacement. Unlike webpack-cli, Parcel does not require a separate CLI package to run commands.
Rollup is a module bundler for JavaScript that compiles small pieces of code into something larger and more complex, such as a library or application. It is known for its efficient output and tree-shaking capabilities. Rollup's CLI is included in the main package, unlike webpack which separates the CLI.
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. It is an older tool compared to webpack and focuses on compatibility with Node.js modules. Browserify's CLI is also part of the main package.
The official CLI of webpack
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.
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
will install it.
We organize webpack CLI as a multi-package repository using lerna. Every command has a dedicated subfolder in the packages
Folder. Here's a summary of commands provided by the CLI.
Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks.
webpack-cli init
- Create a new webpack configuration.webpack-cli info
- Returns information related to the local environment.webpack-cli migrate
- Migrate project from one version to another.webpack-cli generate-plugin
- Initiate new plugin project.webpack-cli generate-loader
- Initiate new loader project.webpack-cli serve
- Use webpack with a development server that provides live reloading.The project also has several utility packages which are used by other commands
utils
- Several utilities used across webpack-cli.generators
- Contains all webpack-cli related yeoman generators.webpack-scaffold
- Utilities to create a webpack scaffold.When you have followed the Getting Started guide of webpack then webpack CLI is already installed! Otherwise, you would need to install webpack CLI and the packages you want to use. If we want to use the init
command to create a new webpack.config.js
configuration file:
npm i webpack-cli @webpack-cli/init
npx webpack-cli init
You will be prompted for some questions about what how you want to generate your config file when running the init
command so webpack CLI can provide the best fitting configuration.
With v3 of webpack CLI, we introduced scaffolding as an integral part of the CLI. Our goal is to simplify the creation of webpack configurations for different purposes. Additionally, sharing such solutions with the community is beneficial and with webpack, we want to allow this. We provide webpack-scaffold
as a utility suite for creating these scaffolds. It contains functions that could be of use for creating a scaffold yourself.
You can read more about Scaffolding, learn How to compose a webpack-scaffold? or generate one with webpack-scaffold-starter.
The webpack family welcomes any contributor, small or big. We are happy to elaborate, guide you through the source code and find issues you might want to work on! To get started have a look at our documentation on contributing.
If you like webpack, please consider donating to our Open Collective to help us maintain it.
FAQs
CLI for webpack & friends
The npm package webpack-cli receives a total of 3,406,433 weekly downloads. As such, webpack-cli popularity was classified as popular.
We found that webpack-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.