ES modules: syntax import vs preprocessing cs plugins

Claus Reinke claus.reinke at
Sat Jun 30 02:20:52 PDT 2012

When reading Dave's post on "Static module resolution" [1],
the section on "Future-compatibility for macros" struck me
as a case where users/proponents of different module systems
seem to be talking past each other. All agree that there is an
important feature, but the approaches differ so much that the
common purpose may not be obvious.

- ES modules:
    compile-time imports allow for syntax import, once
    syntax declarations/exports/macros are introduced

- node modules:
    require.extensions [2] (long time undocumented) allows
    registering alternative loaders for preprocessing alternative
    syntax (coffeescript, streamline, ..)

- require.js/AMD: loader plugins allow to handle alternative
    resource formats as module dependencies [3,4]

I just wanted to make sure that participants in this discussion
are aware of these similarities. [4] does briefly compare AMD's
loader plugins with node's require.extensions.

Btw: for all the usefulness of plugins, they do seem to express
syntax dependencies (which plugin to use) differently than code
dependencies (which modules to load).



More information about the es-discuss mailing list