Hacker News new | ask | show | jobs
by jbish 4315 days ago
Nice work. Just going through the example conversions is helpful in understanding some of the syntax differences.

I'm a bit confused by the Named imports example though. What is the signifance of the __imports_0 variable in both the AMD and CommonJS conversions?

1 comments

Thanks. In the Named imports example, the `import { later } from 'asap'` line means 'load the contents of 'asap.js', and make its 'later' export available to this module as 'later'. In 2014 terms, that means 'assume that asap.js exports an object with a 'later' property, and map that to the 'later' variable' - so '__imports_0' just refers to the object that asap.js exports.

I plan to make this a bit friendlier in a future version of Esperanto: https://github.com/Rich-Harris/esperanto/issues/3