On this page

create-webpack-app generates a working webpack setup so you don't have to assemble one by hand. It scaffolds three things: a project, a loader, or a plugin.

It is a separate package from webpack-cli and does not need to be installed — run it through npx and you get the current version.

npx create-webpack-app webpack-demo
cd webpack-demo

You are asked a short series of questions (language, styling, whether to add a dev server) and the answers become a project with a configuration, an entry point, and npm scripts already wired up.

The positional argument is where to generate the project; it defaults to the current directory.

--force accepts the default answer for every question, which is what you want in a script or when you just need a starting point:

--template picks the framework the project is set up for:

TemplateWhat you get
defaultA plain JavaScript or TypeScript project with CSS and HTML, no framework
reactA React project
vueA Vue project
svelteA Svelte project

Project generation is the init command, which runs by default. These two are equivalent:

npx create-webpack-app ./my-app --template react
npx create-webpack-app init ./my-app --template react
Tip

Scaffolding is a fine way to start, but it is worth reading Getting Started at least once to understand what the generated configuration actually does. Every project outgrows its template eventually.

This generates a loader package with the source, a test setup, and an example project you can run against it — the same layout described in Writing a Loader.

Likewise, this scaffolds a plugin package with its apply method already tapping a compiler hook. Writing a Plugin explains what to do from there.

Both generators accept --template as well, though default is currently the only template for them.