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