Get the App
SLTechnology News&Howtos  ›  Development  › 

What's the difference between babel/plugin-transform-runtime and babel/preset-env?

Shulou Source: shulou.com Published: 2022-06-01 09:34:00 10月01日 Update

This article introduces the relevant knowledge of "what is the difference between babel/plugin-transform-runtime and babel/preset-env". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

@ babel/plugin-transform-runtime

The introduction of generators/async and babel-runtime/core-js (ES6- > includes....) at runtime will not pollute the global environment.

@ babel/preset-env

Convert the latest syntax such as arrow function, class, extension operator, to convert the latest api, you need to introduce babel-polyfill (eg: includes)

@ babel/polyfill

Some new global objects such as api:Iterator, Generator, Set, Map, Proxy, Reflect, Symbol, Promise, and some methods defined on global objects (such as Object.assign) will not be transcoded.

ES6 adds the Array.from method to the Array object.

@ babel-core

The function of babel-core is to parse the js code into ast, which is convenient for each plug-in to process the parsing syntax accordingly.

This is the end of the content of "what's the difference between babel/plugin-transform-runtime and babel/preset-env". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Global object content method more knowledge grammar analysis practicality learning next code function function dilemma reality situation plug-in article case Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB OPPO Reno Shulou Tech Info Docker Linux