Docs: Difference between esnext, es6, es2015 module targets
See original GitHub issueSearch Terms
esnext, es6, es2015, module, tsconfig, tsconfig.json, difference, document
Suggestion
It would be great if this can be documented. On the face of it, the output for all three seems to be identical.
Related: It would also be nice to document why targeting module: "none"
when your code is a module (ie. uses ES2015 imports/exports) generates CommonJS-compatible code instead of exporting to globals as “none” seems to imply.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:207
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Module Compiler Option in TypeScript - tsmean
How the TypeScript docs describe the module compiler option ... Here's a comparison between CommonJS and ES6 / ES2015 / ESNext : ...
Read more >TSConfig Option: target - TypeScript
The target setting changes which JS features are downleveled and which are left intact.
Read more >Typescript: why so complicated?! (A list of my preferred options)
Here's a discussion about module, target, outDir, moduleResolution, lib, etc. ... None; CommonJS; AMD; System; UMD; ES6; ES2015; ESNext.
Read more >Difference between module es2015 vs es2020 - Stack Overflow
If you are wondering about the difference between ES2015 (aka ES6) and ES2020, ES2020 adds support for dynamic imports, and import.meta.
Read more >Which version of EcmaScript should I use in the TypeScript ...
TypeScript allows converting most of the ES next features to ES3, ES5, ES6, ES2016, ES2017. Of course, you can also target ES Next....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To just answer the question, the difference is that
import()
expressions are understood inesnext
, but not ines2015
(and as of TypeScript 2.9,import.meta
is only understood withesnext
).I guess you could possibly expect an
es2019
module target for both.in addition to what @DanielRosenwasser mentioned,
esNext
is just a place holder for features that are on the standard track but is not in an official ES spec yet. e.g.import.meta
andimport()
expressions. as TC39 adds these features to a versioned spec, we will add a new--module ES20**
to reflect that.Also
es6 === es2015
.