valeriangalliat / markdown-it-anchor

A markdown-it plugin that adds an `id` attribute to headings and optionally permalinks.
The Unlicense
291 stars 72 forks source link

How about add ES Modules support? #46

Closed Jack-Kingdom closed 5 years ago

Jack-Kingdom commented 6 years ago

Build failed when integrated with React:

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

    ./node_modules/markdown-it-anchor/index.js:1

Read more here: http://bit.ly/2tRViJ9
srallen commented 6 years ago

The issue is with the spread on this line: https://github.com/valeriangalliat/markdown-it-anchor/blob/1cc288c84ddac11a7047f2adb301b6958929ff19/index.js#L30

~This feature is supported in Node 10, but version 10 isn't LTS yet, so I don't think it's reasonable to expect people to be upgraded yet.~ It's also not fully supported in IE or Edge. ETA: sorry, the syntax looks really similar between rest and spread. This is a rest parameter, so should be supported in node, but it isn't supported in IE. So I'm not sure if this is the issue with the compiling, however, to work around you must include this package in your babel compiling using webpack, browserify, etc.

nagaozen commented 5 years ago

Branch 2019-stack should fix this.