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

Unrecognised top-level tags (eg. <docs>) are parsed as javascript by default #86

Open
baffalop opened this issue May 4, 2023 · 0 comments

Comments

@baffalop
Copy link

baffalop commented May 4, 2023

I'm migrating a large Vue app to Vite. One issue I ran into was with <docs> tags that a few of our SFCs have, which contain documentation in markdown to be read by Storybook. These tags exist at the top level, ie. alongside <template>, <script> and <style>. I would expect them to be ignored. Instead the compiler appears to assume that these tags contain javascript, and as a result Vite (or sometimes the browser) is throwing parse errors.

This issue has previously been mentioned in this discussion, and I was able to solve it following the suggestion in that thread to create a custom Vite plugin to ignore the contents of <docs>, but I believe it constitutes a bug/unexpected behaviour. Why should the contents of a non-<script> tag be run as javascript? I can understand that, as per "Example for transforming custom blocks" in the docs, there is the flexibility to treat additional tags in special ways and I'm sure this is useful, but I don't think "execute as javascript" is a safe default.

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

1 participant