Skip to content

Commit 35023e3

Browse files
authored
doc: update cli documentation for create-webpack-app (#7418)
1 parent 2515ced commit 35023e3

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

src/content/api/cli.mdx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ webpack-cli offers a variety of commands to make working with webpack easier. By
4747
| [`build`](#build) | `build\|bundle\|b [entries...] [options]` | Run webpack (default command, can be omitted). |
4848
| [`configtest`](#configtest) | `configtest\|t [config-path]` | Validate a webpack configuration. |
4949
| [`help`](#help) | `help\|h [command] [option]` | Display help for commands and options. |
50-
| [`info`](#info) | `info\|i [options]` | Outputs information about your system. |
51-
| [`init`](#init) | `init\|create\|c\|new\|n [generation-path] [options]` | Initialize a new webpack project. |
52-
| [`loader`](#loader) | `loader\|l [output-path] [options]` | Scaffold a loader. |
53-
| [`plugin`](#plugin) | `plugin\|p [output-path] [options]` | Scaffold a plugin. |
50+
| [`info`](#info) | `info\|i [options]` | Outputs information about your system. |
5451
| [`serve`](#serve) | `serve\|server\|s [options]` | Run the `webpack-dev-server`. |
5552
| [`version`](#version) | `version\|v [commands...]` | Output the version number of `webpack`, `webpack-cli` and `webpack-dev-server`. |
5653
| [`watch`](#watch) | `watch\|w [entries...] [options]` | Run webpack and watch for files changes. |
@@ -71,16 +68,22 @@ npx webpack build --config ./webpack.config.js --stats verbose
7168

7269
### Init
7370

74-
Used to initialize a new webpack project.
71+
Used to initialize a new webpack project using `create-new-webpack-app`.
7572

7673
```bash
77-
npx webpack init [generation-path] [options]
74+
npx create-new-webpack-app [generation-path] [options]
7875
```
7976

8077
**example**
8178

8279
```bash
83-
npx webpack init ./my-app --force --template=default
80+
npx create-new-webpack-app ./my-app --force --template=default
81+
```
82+
83+
Alias to:
84+
85+
```bash
86+
npx create-new-webpack-app init ./my-app --force --template=default
8487
```
8588

8689
#### Generation Path
@@ -101,20 +104,25 @@ Name of template to generate.
101104

102105
To generate a project without questions. When enabled, the default answer for each question will be used.
103106

104-
T> See the [full documentation of `webpack init` command](https://github.com/webpack/webpack-cli/blob/master/packages/generators/INIT.md).
107+
#### Templates supported
108+
109+
- `--template=default` - Default template with basic configuration.
110+
- `--template=react` - Template with React configuration.
111+
- `--template=vue` - Template with Vue configuration.
112+
- `--template=svelte` - Template with Svelte configuration.`
105113

106114
### Loader
107115

108116
Scaffold a loader.
109117

110118
```bash
111-
npx webpack loader [output-path] [options]
119+
npx create-new-webpack-app loader [output-path] [options]
112120
```
113121

114122
**example**
115123

116124
```bash
117-
npx webpack loader ./my-loader --template=default
125+
npx create-new-webpack-app loader ./my-loader --template=default
118126
```
119127

120128
#### Output Path
@@ -134,13 +142,13 @@ Type of template.
134142
Scaffold a plugin.
135143

136144
```bash
137-
npx webpack plugin [output-path] [options]
145+
npx create-new-webpack-app plugin [output-path] [options]
138146
```
139147

140148
**example**
141149

142150
```bash
143-
npx webpack plugin ./my-plugin --template=default
151+
npx create-new-webpack-app plugin ./my-plugin --template=default
144152
```
145153

146154
#### Output Path
@@ -155,6 +163,8 @@ Path to the output directory, e.g. `./plugin-name`.
155163

156164
Type of template.
157165

166+
T> See the [full documentation of `create-new-webpack-app`](https://github.com/webpack/webpack-cli/blob/master/packages/create-webpack-app/README.md).
167+
158168
### Info
159169

160170
Outputs information about your system.

0 commit comments

Comments
 (0)