import script --> .esm

Allen Wirfs-Brock allen at
Wed Sep 10 09:21:24 PDT 2014

On Sep 10, 2014, at 8:44 AM, Matthew Robb wrote:

> Personally I have felt this way for a long time as well. I think `.esm` is somewhat confusing since most js developers don't really think about it as EcmaScript. I would think you could just as easily do `.jsm` but this also suggests that files of this alternate should be served with a different mime type such as `text/javascript-module` or something along those lines.

I also agree (and have argued) that an external discrimination of modules and scripts is going to be a practical necessity and that file extension is the most natural way to do so.  Consider a couple basic situations:

1) linters need to know whether whether to apply script or module (including implicit strict) to the source files they process. 

2) a command line js engine needs to know which source files listed on the command line are intended to be processed as scripts which need to be loaded as modules.

command line switches or other affordances could be used to make this discrimination.  But file extensions are the more traditional approach.

But, such conventions seem to be outside the scope of ECMA-262.  .js isn't something that has appeared in any standard, as far as I know.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list