Home  >  Article  >  Web Front-end  >  Is es6 compatible with ie8?

Is es6 compatible with ie8?

WBOY
WBOYOriginal
2022-04-26 10:24:231754browse

es6 is not compatible with ie8, and is only compatible with some es6 APIs in ie10 and ie11; the method to achieve compatibility: you can use "babel-loader" to compile es6 code into es5 for execution in ie8, use " npm install babel-loader" to install.

Is es6 compatible with ie8?

The operating environment of this tutorial: Windows 10 system, ECMAScript version 6.0, Dell G3 computer.

Is es6 compatible with ie8

es6 is not compatible with ie8

IE browser does not support ES6 syntax, and only supports part of it in IE10 and IE11 ES6 API, so when using ES6 in IE browser, you need to compile the ES6 code into ES5 before it can be executed. The method is also very simple, just use babel-loader.

Currently, syntax such as ES6 (ES2015) has been widely used. It is more concise and more powerful. In actual projects, modules using ES6 syntax are likely to be used, but browsing The server's support for ES6 syntax is not perfect. In order to achieve compatibility, you need to use a conversion tool to convert ES6 syntax to ES5 syntax. Babel is the most commonly used tool

Is es6 compatible with ie8?

The dependencies required for babel conversion syntax:

  • babel-loader: Responsible for es6 syntax conversion

  • babel-core: babel core package

  • babel- preset-env: Tell babel which transcoding rules to use for file processing

Installation dependencies

npm install babel-loader @babel/core @babel/preset-env --save-dev

Configuration config file

exclude means not to search for related files in the specified directory

[Related recommendations: javascript video tutorial, web front-end]

The above is the detailed content of Is es6 compatible with ie8?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn