-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
What version of @astrojs/compiler are you using?
2.7.0
What package manager are you using?
npm
What operating system are you using?
mac
Describe the Bug
If I use astro's <Code> component in a page for vue code, and the vue code contains an import statement, astro thinks it's an actual import statement.
<Code
lang="vue"
code={`
<script setup>
import 'something';
</script>
<template>
<calendar-range :months="2">
<calendar-month />
<calendar-month :offset="1" />
</calendar-range>
</template>
`.trim()}
/>i get the following error in the console on start:
16:59:37 [ERROR] [vite] Error: The following dependencies are imported but could not be resolved:
something (imported by /home/projects/astro-import-inside-code-string-repro/src/pages/index.astro?id=0)
Are they installed?
at eval (/home/projects/astro-import-inside-code-string-repro/node_modules/vite/dist/node/chunks/dep-BBHrJRja.js:52555:23)
at async eval (/home/projects/astro-import-inside-code-string-repro/node_modules/vite/dist/node/chunks/dep-BBHrJRja.js:52021:38)
I suspect this is caused by the <script> tag in the code string, more than the lang being vue. but of course in vue components, script tags are common
Link to Minimal Reproducible Example
Metadata
Metadata
Assignees
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)