-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Not working with Vue 3 #1718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
xdm works now with vue 3: https://github.com/wooorm/xdm#vue. |
Thank you 👍 |
The docs have been updated but the code has not been published. Are you using Vue 3 with Vue CLI? Can you swap out |
i still get the error. |
@jannikbuscha could you share a complete example of what you tried in a codesandbox? https://vue.new |
https://codesandbox.io/s/cool-breeze-e66xz?file=/src/App.vue |
Nice catch. Can I interest you in a fix for the docs? |
For the second part: that’s because you have not configured .options({jsx: true, providerImportSource: '@mdx-js/vue' /* otherOptions… */}) |
and codesandbox (https://codesandbox.io/s/heuristic-lovelace-rim55?file=/src/App.vue): here my repo: |
Trying out your repo works perfectly for me, no errors. diff --git a/src/App.vue b/src/App.vue
index eee837e..1bcf76e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,6 @@
<template>
<h1>Test</h1>
+ <MDXProvider v-bind:components="components"><Post /></MDXProvider>
</template>
<script lang="ts">
@@ -9,6 +10,9 @@ import {MDXProvider} from '@mdx-js/vue'
import Post from './post.mdx'
@Options({
+ data() {
+ return { components: { h1: "h2" } };
+ },
components: {
MDXProvider, Post
}, If your IDE is breaking, that’s likely due to it not supporting ESM. See: https://v2.mdxjs.com/docs/troubleshooting-mdx/#problems-integrating-mdx. It’s a problem they should fix. For codesandbox, something is going wrong there indeed. You can add a |
yes it seems like my ide is causing some problems. I have now tested the whole thing with gitpod and so far everything works. The question I have now is, how do I build something like gfm with the MDXProvider component? if I do that as in the vue example then I get the following error: |
You’re attempting to run Vue inside Vue and MDX inside MDX. You don’t have to! |
I don't think I really understand this yet. Where exactly does this need to be configured? I have now tried the two things in my vue.config.js: |
Before, you tried to import it. That’s what you have to do again. That’s what’s shown in the guide: https://v2.mdxjs.com/guides/gfm/.
If you removed that because you were getting errors that you were not allowed to import things, then you can see the ESM troubleshooting I linked to earlier for more info and ask Vue CLI folks for help. ESM in |
Thank you very much for your detailed help. |
@jannikbuscha have you seen vuejs/vue-cli#4477 and vuejs/vue-cli#6405? |
|
vuejs/vue-cli#6592 (comment) might help? It looks like the loader isn't being applied. |
|
Your last screenshot is very close. However, as I mentioned before, while vue-cli added support for Here’s how I can make your project work for me locally.
diff --git a/package.json b/package.json
index 884779f..d2f602d 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,6 @@
},
"dependencies": {
"@mdx-js/loader": "^2.0.0-rc.1",
- "@mdx-js/mdx": "^2.0.0-rc.1",
"@mdx-js/vue": "^2.0.0-rc.1",
"core-js": "^3.6.5",
"remark-gfm": "^3.0.0",
@@ -17,16 +16,16 @@
"vue-class-component": "^8.0.0-0"
},
"devDependencies": {
- "@typescript-eslint/eslint-plugin": "^4.18.0",
- "@typescript-eslint/parser": "^4.18.0",
+ "@typescript-eslint/eslint-plugin": "^5.1.0",
+ "@typescript-eslint/parser": "^5.1.0",
"@vue/babel-plugin-jsx": "^1.1.1",
- "@vue/cli-plugin-babel": "~4.5.0",
- "@vue/cli-plugin-eslint": "~4.5.0",
- "@vue/cli-plugin-typescript": "~4.5.0",
- "@vue/cli-service": "~4.5.0",
+ "@vue/cli-plugin-babel": "5.0.0-beta.6",
+ "@vue/cli-plugin-eslint": "5.0.0-beta.6",
+ "@vue/cli-plugin-typescript": "5.0.0-beta.6",
+ "@vue/cli-service": "5.0.0-beta.6",
"@vue/compiler-sfc": "^3.0.0",
- "@vue/eslint-config-typescript": "^7.0.0",
- "eslint": "^6.7.2",
+ "@vue/eslint-config-typescript": "^8.0.0",
+ "eslint": "^8.0.0",
"eslint-plugin-vue": "^7.0.0",
"typescript": "~4.1.5"
}
|
|
Not working with Vue 3
When I create a Project like this: https://github.com/mdx-js/mdx/tree/master/examples/vue with Vue 3, I get this warning:

Also nothing happens
The text was updated successfully, but these errors were encountered: