Skip to content

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

Open
@baffalop

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions