webpack simple to use

First, install the node comes because npm

Global Installation Webpack npm i -g webpack

npm the init file is automatically created package.json

Webpack installed in the development environment npm install webpack -D

Installations rely NPM the install package to produce node-modules

 

In the project, create a profile of webpack.config.js webpack

In writing about the contents inside

module.exports={
  watch: true, // monitor
  // entry file
  entry:"./src/main.js",
  //Export File
  output:{
      filename:"./dist/build.js"
  }
}
 
package.json configuration bulid in the project
"scripts": {
    "build": "webpack"
  },
 
In the terminal performs npm run build file will produce a result in the project dist

 

Guess you like

Origin www.cnblogs.com/skydragonli/p/11546552.html