-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
Description
Environment
- Operating System:
Darwin - Node Version:
v18.16.1 - Nuxt Version:
3.6.5 - Nitro Version:
2.5.2 - Package Manager:
npm@9.5.1 - Builder:
vite - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
See here for a repro: https://github.com/dan-hammond/imports-types-repro
Alternatively, below are the steps to recreate it locally with ease:
npx nuxi init -t module my-module
cd my-module
npm i --legacy-peer-deps
npm run dev:prepare
Create a file like ~/src/runtime/TemplatePage.vue with the following contents:
<template>
<div>hello {{ world }}</div>
</template>
<script lang="ts" setup>
import {
computed,
} from "#imports";
const world = computed( () => "world" );
</script>
The error will be immediately apparent.
Describe the bug
When creating a Nuxt module, Vue files in the runtime folder don't seem to pick up the TypeScript aliases generated by Nuxt. It errors with the following:
Cannot find module '#imports' or its corresponding type declarations.ts(2307)
For comparison, I cloned nuxt/content and added the same Vue file in that repo's runtime folder, which works as intended. I can't work out what the difference is that causes the issue in a fresh module.
Additional context
No response
Logs
No response
Reactions are currently unavailable
