Open arlyon opened 2 years ago
I would also be very interested in this, since this is the only issue that keeps me from switching from next-mdx-remote
to mdx-bundler
, as all of my MDX components are using twin.macro
. It seems to have to do with esbuild and babel-plugin-macros
, but I'm also not entirely sure. Tried googling a bit, but haven't found much apart from a tweet, suspecting the same thing.
Any news on this one? Have you been able to find a working solution, @arlyon ? I haven't had much success, but would be very interested in figuring this one out, as it would really make a big difference to be able to use twin.macro
with mdx-bundler
. If @kentcdodds says this should just work as is, I will keep trying, but in the past 2 weeks I didn't really get anywhere with this.
I'm afraid I haven't tried using any of these tools with mdx-bundler, but keep in mind that compilation is handled by esbuild which does not support babel plugins so I don't know that you'll be able to get these things working...
Thanks for your answer @kentcdodds. What would need to happen to get the two packages to work together? I am not so familiar with ESBuild / Babel etc., so I'm a bit stuck, but I would like to maybe at least give it a try, if it's in principle doable.
I think in theory it's possible, but I don't know how I'm afraid. Sorry.
mdx-bundler
version: 6.0.2node
version: 14.17.6npm
version: 6.14.15Relevant code or config
Sample mdx file using
twin.macro
(https://github.com/ben-rogerson/twin.macro)Here's what happens during development:
Problem description:
I am serving it over nextjs and, from what I understand, this issue arises because twin.macro is intended to be run at build time but isn't being invoked properly. My gut says esbuild isn't playing nicely since
twin.macro
usesbabel-plugin-macros
, so the question is does this support tools utilisingbabel-plugin-macros
in the MDX and how do we make it happen? If it is supposed to 'just work', then I'll whip up a repro-repo as well.