Skip to content

vue: Loading a page that raw imports a vue template file fails #1918

Closed
@jmurth1234

Description

@jmurth1234

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
    Use Vite >=2.0. (1.x is no longer supported)
    If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

In a project I have, I implement code samples in the docs by doing a raw-loader import of the source code of a component. However, when importing one of these Vue components via the ?raw syntax, running the project fails with a Cannot read property 'line' of undefined error.

This does not happen with, for instance, a raw TypeScript file (commented out in example repo).

Reproduction

Here's a minimum repo, bassed upon a vue-ts template: https://github.com/rymate1234/vite-raw-repro-bug

System Info

  • vite version: 2.0.0-beta.65
  • Operating System: Windows 10
  • Node version: v14.15.1
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      vue: Loading a page that raw imports a vue template file fails · Issue #1918 · vitejs/vite