Webpack Basic Use

Source: Internet
Author: User

Compile with Webstorm:

1. Create a new project (the most basic project)

2. On the Webstorm console, use the command line CNPM install WEBPACK-G global Installation

3. After installation, you can use Webpack-h to see if the Webpack installation is complete.

4. After that, cnpm install Webpack--save-dev will webpack installed to the project's dependencies

6. Best, install loader, CNPM installs--save-dev Css-loader and CNPM installed--save-dev Style-loader

7. In the project, first create a static page index.html and a JS entry file Entry.js (generated by Webpack)

8. Use a src folder to place source files, including CSS files and JS (contains JS master file main.js)

9. Create a Webpack.config.js (1) var webpack = require (' Webpack ') under the current root directory; (2

Module.exports = {

Entry: './src/main.js ',

Output: {

        Path: ' ${__dirname}/build ',
FileName: ' Bundle.js '
},
Module: {
Loaders: [
{test:/\.css$/, Loader: ' Style!css '}
]
}
};
10. Enter Webpack in the Webstorm console to generate the JS entry file Entry.js

Webpack Basic Use

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.