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-cli
npx webpack-cli init
webpack-cli init
To generate default template
webpack-cli init
To generate with default answers
webpack-cli init --force
To scaffold in a specified path
webpack-cli init [path]
To scaffold specified template
webpack-cli init --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.
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
.
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.