Skip to content

Latest commit

 

History

History
93 lines (58 loc) · 2.5 KB

File metadata and controls

93 lines (58 loc) · 2.5 KB

create-webpack-app

create-webpack-app is used to initialize webpack projects quickly by scaffolding configuration and creating a runnable project with all the dependencies based on the user preferences.

Table of Contents

Setup

Install webpack and webpack-cli as devDependencies

npm install --save-dev webpack webpack-cli

Usage

Running Locally

npx create-webpack-app

Running Globally

create-webpack-app

CLI options

To generate default template

create-webpack-app

To generate with default answers

create-webpack-app -f, --force

To scaffold in a specified path

create-webpack-app [generation-path]

To scaffold specified template

create-webpack-app -t, --template <template-name>

Description of questions asked by the generator

Default template

  1. 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.

  1. 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.

  1. 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.

  1. Do you want to add PWA support?

Adds workbox-webpack-plugin which generates a complete service worker for you.

  1. 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.