Arcath / alaycock.co.uk

My personal site built with remix.
https://www.alaycock.co.uk
1 stars 0 forks source link

mdx-bundler for React pure #1

Open tienlx97 opened 2 years ago

tienlx97 commented 2 years ago

Excuse me. I have a question ? Can I use mdx-bundler in react (without using nextjs, remix,...). I store mdx compile string in mongodb then use mdx-bundler on browser to decompile it ? I mean: 1 server compile mdx file -> store in in database (use monorepo to share component between server and UI). Then at front-end I fetch it from databse -> decompile -> show to UI

Arcath commented 2 years ago

MDX-Bundler doesn't rely on a framework. You can use it in plain node.

It won't work in browser as esbuild needs to be run on the server.

tienlx97 commented 2 years ago

@Arcath yeah, use esbuild & mdx-bundler in server. Because I use react CSR so I put component as global in mdx-bundler. This leads me to not get the power out of mdx-bundler . But I will use react SSR in the future.

tienlx97 commented 2 years ago

@Arcath I have another question: Can I use import { /* components */ } from '@path/mdxComps' inside mdx file if I set @path/mdxComps is globals