Create a Sample Project

Advertisement

To set up the Webpack, we need to create a sample project.

NOTE: If you already have created a project then you can avoid this article.

We are going to see:

Create a Directory Create a Directory

I’m creating a directory webpack-tutorial within the location c:\xampp\htdocs\tutorials with mkdir CLI command:

mkdir webpack-tutorial

E.g.

c:\xampp\htdocs\tutorials
? mkdir webpack-tutorial

Top ↑

Navigate into the webpack-tutorial directory with command:

cd webpack-tutorial

E.g.

c:\xampp\htdocs\tutorials
? cd webpack-tutorial\

Top ↑

Create package.json Create package.json

Lets create a package.json file with command:

npm init -y

E.g.

c:\xampp\htdocs\tutorials\webpack-tutorial
? npm init -y
Wrote to c:\xampp\htdocs\tutorials\webpack-tutorial\package.json:

{
  "name": "webpack-tutorial",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

After executing the above command; we can see the file package.json into the directory webpack-tutorial

Now, we have setup the sample project to use the webpack bundler.

Leave a Reply