Detailed package.json

1. The scripts field

  Similar to shortcut keys, give a complex command a simple name

  When we use: npm run short name in the command window, it is equivalent to running the complex command it represents

2. dependencies field, devDependencies field

  dependencies specifies the modules that the project depends on to run, and devDependencies specifies the modules required for project development

  The version number "~3.3.7" means to install the latest version of the 3.3.x series, not to install the version of the 4.xx series

  The version number "^3.3.7" means to install the latest version of the 3.xx series, not to install the version of the 4.xx series

  The version number "3.3.7" represents the fixed version 3.3.7 installed

3, the main field, specify the loaded entry file

4. Module loader (npm install xxx-loader --save-dev)

  Babel is a tool that can convert es6 content to es5 content

  css-loader processes css files

  style-loader handles css style files

  html-loader processes html files

  (webpack can only package js files by default. If an error is reported for CSS or other file packaging, it means that the corresponding loader needs to be installed to support webpack packaging)

  webpack-dev-server is a lightweight service, the function modification code is presented to the browser in time, the installation command: npm install webpack-dev-server -g

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324972458&siteId=291194637