Babel preset-env to browser

  1. here"s the problem. The es6 specification for writing code at the front end. Browsers do not fully support
  2. . The problem arises when
  3. uses babel transformations. Babel can not directly transfer the code used by the browser, must use other tools? People like browserify.

here is the configuration in the document using the plug-in env

{
  "presets": [
    ["env", {
      "targets": {
        "browsers": ["last 2 versions", "safari >= 7"]
      }
      modules: "amd"
    }]
  ]
}
The

browsers field is compatible with the browser, so is it possible to directly babel the code used by the browser by using the plug-in env?
Why do you always rely on other tools, such as browserify? Is modules amd not the loading method used by browsers?
I saw it on the Internet. It is said that it is the specification for converting babel to commonjs, and then the way for browserify to be converted into a browser. Then why not just babel to amd?

Menu