webpack-cli init is used to initialize webpack projects quickly by scaffolding configuration and creating a runnable project with all the dependencies based on the user preferences.
Install webpack and webpack-cli as devDependencies
npm install --save-dev webpack webpack-clinpx webpack-cli initwebpack-cli initTo generate default template
webpack-cli initTo generate with default answers
webpack-cli init -f, --forceTo scaffold in a specified path
webpack-cli init [generation-path]To scaffold specified template
webpack-cli init -t, --template <template-name>Which of the following JS solutions do you want to use?
Property/key resolved: module.rules (for .js, .ts and other related files)
This enables webpack to parse ES2015 code or Typescript code as per choice.
Do you want to use webpack-dev-server?
Property/key resolved: module.rules
Adds a development server to serve webpack bundles and hence make development faster.
Do you want to simplify the creation of HTML files for your bundle?
Adds html-webpack-plugin that simplifies creation of HTML files to serve your bundles.
Do you want to add PWA support?
Adds workbox-webpack-plugin which generates a complete service worker for you.
Which of the following CSS solutions do you want to use?
Property/key resolved: module.rules (for .css files)
If you use any sort of style in your project, such as .css you will need to select this here. If you don't use CSS, answer none.