Search code examples
typescriptes6-modules

Difference between module es2015 vs es2020


What is the difference between module es2015 and es2020 option in ts.config?

In other words, is there any difference if I use es2015 modules and configure the module option to es2015 or es2020?

ts-config:

{
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
  module: 'es2015'
}

vs

{
  ...
  "module": "es2020"
  ...
}

I do not want the target or lib difference.


Solution

  • From the documentation for that option:

    If you are wondering about the difference between ES2015 (aka ES6) and ES2020, ES2020 adds support for dynamic imports, and import.meta.