ticky / markdown-component-loader

📑 Turn Markdown into dynamic, stateless React components
https://ticky.github.io/markdown-component-loader/
MIT License
71 stars 8 forks source link

Node.js module output format #18

Open davidtheclark opened 7 years ago

davidtheclark commented 7 years ago

Currently the loader uses ES2015 import and export default. Are you interested in adding options to allow for Node.js module require and module.exports? If so, I could work on a PR.

ticky commented 7 years ago

I’d been making moves towards this by making the formatters pretty generic. I could see a future where the API includes the ability to override them, and/or includes versions for each module style.

As an aside, do recent versions of Node handle spread syntax? It’s been a while since I checked! :)

davidtheclark commented 7 years ago

do recent versions of Node handle spread syntax

For Array spreads, looks like there's support in 4 with a flag and then full support in 5+.

For Object spreads, looks like only 8+ with a flag.

I’d been making moves towards this by making the formatters pretty generic.

Yeah, I think that structure will make the change straightforward. I can try to work out a PR today.

ticky commented 7 years ago

Cool! Sounds good to go ahead with keeping, then!