detecting JS language mode for tools

John Lenz concavelenz at
Mon Jan 27 22:40:12 PST 2014

There  are three issues in my mind for tooling:
1) should the code be parsed as "use strict"
2) are "import" and "export" and "module" statements valid
3) should top level declarations be considered visible outside the file (no
can be inferred from the presence of import or exports)

It is my guess that it will be a common beginner mistake to load modules as
scripts or try to use "import" from scripts.  The first is the primary one
as keywords etc are different.

On Mon, Jan 27, 2014 at 8:43 PM, Kevin Smith <zenparsing at> wrote:

>> My argument was that Node.js has both non-module and module files with a
>> common suffix, .js.
> Yes - but Node-modules and non-modules can be parsed the same way, so a
> common extension makes sense.  But when a file needs to be parsed a
> different way in Node, how's that's done?  By registered file extensions,
> of course.
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list