VUE,axios installed es6-promise, for compatibility with IE,. Why is it-- save-dev instead of-- save?

this is not needed in the production environment, how to install the development environment is dependent, and the production environment is also effective?

clipboard.png

require("es6-promise").polyfill();
Aug.28,2021
The syntax of

es6 is used by the development environment, and the code that is compiled into es5,es5 is recognized by the browser. So you only use-- save-dev for this plugin. And like some libraries, you also need to use in the production environment, use-- save, such as JQuery, itself is a browser can run the js library, in the production environment is still used as is, compilation will not change the syntax.


-- save--dev depends on both development and production

entering npm install, normally installs both dependencies and devDependencies, so you can't see the difference.

execute npm install-- production , install only dependencies, and ignore devDependencies.

so it's best to distinguish between production and development packages


npm run build converts es6 to es5, so it's useless after packaging, it's just a tool

Menu