Webpack tutorial (1)-first experience, first experience

Source: Internet
Author: User
Tags webpack tutorial

Webpack tutorial (1)-first experience, first experience

First, install webpack globally, then initialize a project in npm, and install the webpack development tool locally.

$ Npm install webpack-g
Npm init (project name)

$ Npm install webpack-dev-server -- save-dev

Create an app folder in the project directory, create an index. js file, and write the following code:

Console. log ('Hello World ');

Open the command line in the project folder and enter the following command

Webpack app/index. js build/index. js

The following code is successful:

 

Check the code of the build/index. js file:

The 73 lines are the code of our app/index. js file.

We will analyze the specific source code in another day. Today, our main goal is to experience it.

In this way, coding is too inefficient. We can use the webpack. config. js file to complete more advanced functions.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.