mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.76k stars 1.14k forks source link

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

Closed luobingxun closed 2 months ago

luobingxun commented 8 months ago

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 commented 8 months ago

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

wooorm commented 8 months ago

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?