Skip to content
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

Update to v0.21.0 breaks the build because of route lang="json" blocks #178

Closed
kouts opened this issue Mar 1, 2022 · 8 comments
Closed

Comments

@kouts
Copy link

kouts commented Mar 1, 2022

Hello, thanks for your great work in this vite plugin.
In version 0.20.2 <route lang="json"> blocks work ok and is an easy way to get syntax highlighting.
In version 0.21.0 using <route lang="json"> produces an error SyntaxError: import not found: default

Here's a reproduction
https://stackblitz.com/edit/github-ijnjm5-3ce2um?file=src/pages/index.vue

@hannoeru
Copy link
Owner

hannoeru commented Mar 1, 2022

This is related to unplugin-vue-components,
looks like they added this comment to route block, which shouldn't be happening.

スクリーンショット 2022-03-02 2 36 47

Can you open a new issue there?

@kouts
Copy link
Author

kouts commented Mar 1, 2022

In my local project where this is happening I don't have unplugin-vue-components installed so it must be something else. I'll try to reproduce it in another Stackblitz.
Thanks @hannoeru

@kouts
Copy link
Author

kouts commented Mar 2, 2022

That fixed it @hannoeru, thanks

@LukasKnuth
Copy link

LukasKnuth commented Mar 4, 2022

Posting on this because I have the same error (also using unplugin-vue-components in my project) but I'm using lang="yaml" which still fails with "vite-plugin-pages": "^0.21.2".

Since you fixed this specifically for the JSON plugin, is it possible that a specific fix for YAML is required as well?


I have observed a lot of weird behaviour with this.

  1. It only fails for Markdown components transformed with https://github.com/antfu/vite-plugin-md
  2. It fails for the Markdown block if I don't put text with spaces into " quotes.
  3. If I quote all text, I get the above mentioned no default export error.

@hannoeru
Copy link
Owner

hannoeru commented Mar 4, 2022

@LukasKnuth can you provide a reproduction?

@LukasKnuth
Copy link

@hannoeru I have made https://github.com/LukasKnuth/codeislandorg_vue public. If you update "vite-plugin-pages": "^0.21.2" and run npm run build, you'll get the error. The markdown pages are under src/pages/blog.

Let me know if you need more info

@hannoeru
Copy link
Owner

hannoeru commented Mar 4, 2022

@LukasKnuth fixed, try v0.21.3.

@LukasKnuth
Copy link

@hannoeru It works. Crazy how fast you are on these changes, much appreciated!

ckangwen pushed a commit to charrue/vite-plugin-pages that referenced this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants