mdx icon indicating copy to clipboard operation
mdx copied to clipboard

MDXProvider is invalid after processSync processing when {jsxImportSource: 'vue', providerImportSource: '@mdx-js/vue'} is configured.

Open luobingxun opened this issue 1 year ago • 2 comments

Initial checklist

Affected packages and versions

3.0.1

Link to runnable example

No response

Steps to reproduce

  1. Write vite plug-in and use createProcessor provided by mdx. createProcessor({jsxImportSource: 'vue',providerImportSource: '@mdx-js/vue'})
  2. Use MDXProvider in jsx translated by @vitejs/plugin-vue-jsx plug-in to find that the components cannot be customized

Expected behavior

The MDXProvider can customize the components in the mdx file

Actual behavior

Cannot be customized, the components provided by the MDXProvider are invalid, and a warning is reported in the browser console inject() can only be used inside setup() or functional components.

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

luobingxun avatar Mar 06 '24 03:03 luobingxun

demo warehouse address: https://github.com/miss-money/vite-plugin-mdx-demo-test/tree/master/demo/vue

luobingxun avatar Mar 06 '24 03:03 luobingxun

This sounds like a bug in @vitejs/plugin-vue-jsx, why report it here not there? MDX compiles the jsx away already. That plugin doesn't see jsx?

wooorm avatar Mar 06 '24 10:03 wooorm