Closed alinex closed 8 years ago
Yes I can confirm the issue. I had to use(markdownItTocAndAnchor.default)
That's an issue coming from the change from Babel 5 to Babel 6 between v2.0.0 and v2.1.0. The previous 'export default' transpilation in Babel 5 was incorrect according to ES6 spec. see :
I'll post a pull request that uses this babel plugin, restoring CommonJS import functionality without using the 'default' property, in the case where the ES6 module has ONLY the default export, which is the case here.
Maybe documenting this is a better idea instead of adding this plugin.
Note that this doesn't cause an ES6 style module import to break, as long as there is only a default export the behavior is correct in both worlds, and if not anymore, the aforementioned plugin wouldn't do anything anymore. Since markdown-it plugins have only a single export, i don't see a problem with this behavior. But if you prefer i can make a pull request updating documentation with node syntax example containing 'default'.
I would prefer that indeed (an es5/commonjs example).
If I use the new version 2.1.0 I get the error:
I had a look at what the plugin exports (an object):
Now I switched back to version 2.0.0 and it works again. The plugin exports a function now:
Maybe there is a small problem here which you hopefully can fix.