content: (bug): Nuxt typecheck is broken with nuxt/content@2.8.0
Environment
- Operating System: Linux
- Node Version: v16.20.0
- Nuxt Version: 3.7.0
- CLI Version: 3.7.2
- Nitro Version: 2.6.2
- Package Manager: npm@9.4.2
- Builder: -
- User Config: modules
- Runtime Modules: @nuxt/content@2.8.0
- Build Modules: -
Reproduction
https://stackblitz.com/edit/github-jvxdxz?file=README.md
Describe the bug
With the release of @nuxt/content@2.8.0 it seems like the typecheck command for Nuxt breaks.
Two main warnings/errors pop up
- One: the
@nuxtjs/mdcpackage, specifically in theProseH1.vue->ProseH6.vuefiles have typescript issues that bubble up when runningnuxt typecheck - Two:
ProseCode.vueseems to be resolved twice (Check the logs section for the full error logs)
In my mind there are two problems here
- The type issue that exists in the module which breaks typecheck for the entire project
- The fact that Nuxt is checking types within node_modules in the first place. Surely this is not expected behaviour
Additional context
No response
Logs
Warning logs when running nuxt dev or nuxt typecheck
WARN [nuxt] Two component files resolving to the same name ProseCode: 11:48:06 am
- /PATH_TO_REPO/node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseCode.vue
- /PATH_TO_REPO/node_modules/.pnpm/@nuxt+content@2.8.0_vue@3.3.4/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseCode.vue
Error logs when running nuxt typecheck
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH1.vue:19:45 - error TS18048: 'headings' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h1)
~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH1.vue:19:45 - error TS18048: 'headings.anchorLinks' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h1)
~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH2.vue:19:45 - error TS18048: 'headings' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h2)
~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH2.vue:19:45 - error TS18048: 'headings.anchorLinks' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h2)
~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH3.vue:19:45 - error TS18048: 'headings' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h3)
~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH3.vue:19:45 - error TS18048: 'headings.anchorLinks' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h3)
~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH4.vue:19:45 - error TS18048: 'headings' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h4)
~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH4.vue:19:45 - error TS18048: 'headings.anchorLinks' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h4)
~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH5.vue:19:45 - error TS18048: 'headings' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h5)
~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH5.vue:19:45 - error TS18048: 'headings.anchorLinks' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h5)
~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH6.vue:19:45 - error TS18048: 'headings' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h6)
~~~~~~~~
node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH6.vue:19:45 - error TS18048: 'headings.anchorLinks' is possibly 'undefined'.
19 const generate = computed(() => props.id && headings.anchorLinks.h6)
~~~~~~~~~~~~~~~~~~~~
Found 12 errors in 6 files.
Errors Files
2 node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH1.vue:19
2 node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH2.vue:19
2 node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH3.vue:19
2 node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH4.vue:19
2 node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH5.vue:19
2 node_modules/.pnpm/@nuxtjs+mdc@0.1.2/node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH6.vue:19
ERROR Command failed with exit code 2: vue-tsc --noEmit 11:48:08 am
at makeError (node_modules/.pnpm/nuxi@3.7.2/node_modules/nuxi/dist/chunks/index3.mjs:625:11)
at handlePromise (node_modules/.pnpm/nuxi@3.7.2/node_modules/nuxi/dist/chunks/index3.mjs:1688:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.run (node_modules/.pnpm/nuxi@3.7.2/node_modules/nuxi/dist/chunks/typecheck.mjs:81:7)
at async runCommand$1 (node_modules/.pnpm/nuxi@3.7.2/node_modules/nuxi/dist/shared/nuxi.c627b411.mjs:1644:5)
at async runCommand$1 (node_modules/.pnpm/nuxi@3.7.2/node_modules/nuxi/dist/shared/nuxi.c627b411.mjs:1638:7)
at async runMain$1 (node_modules/.pnpm/nuxi@3.7.2/node_modules/nuxi/dist/shared/nuxi.c627b411.mjs:1756:7)
ERROR Command failed with exit code 2: vue-tsc --noEmit 11:48:08 am
error Command failed with exit code 1.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 20
- Comments: 26 (10 by maintainers)
Was this bug fixed? I received the same warning.
any update ?
Hi All Finally I can confirn ProseCode and ProsePre has gone after I update nuxt to 3.7.2 The issue of slow startup is fixed too
I hope this issue not comeback again
Any other one, is the issue fixed to on latest nuxt ?
The
WARN [nuxt] Two component files resolving to the same name ProseCode: 4:50:12 PMare resolved on nuxt edge via https://github.com/nuxt/nuxt/pull/22882.I can confirm that the type errors have been fixed with v2.8.1.
The Prose override warnings have already been reported in #2262 and nuxt/nuxt#22876, and have been solved in Nuxt’s edge channel with nuxt/nuxt#22882
On edge I can still see the warning:
Is any update on this issue ? Btw my development experience is so bad, I dont know this related to nuxt content, tailwind, or any other thing But currently my startup time is CRAZY slow, any one experience the same thing ?
Just wait 3 minute for nitro built 😦
I also get it with edge-channel: https://stackblitz.com/edit/github-fu8htb?file=package.json
Maybe because both are modules and therefore have the same priority?
Alright, closing this issue now. I’ve confirmed the reported issues are no longer present as of
nuxt 3.7.3and@nuxt/content 2.8.2Thank you to everyone who helped fix this 😄@manniL No, as far as I can see, it is solved: https://stackblitz.com/edit/github-fu8htb-vzqfsb?file=package.json There are no warnings logged with
Content v2.8.2andNuxt v3.7.2anymore.Show startup logs
#2302 was one way to fix it, but the issue seems to be resolved with nuxt/nuxt#23156. So #2302 doesn’t seem to be needed anymore.
If you can share a reproduction where there are warnings with these package versions, then this issue should not be closed, of course.
FYI – Got the same on a fresh install with:
Ah, sorry. I mis-read that the issue is fixed. I’ll wait for the Edge-channel to be merged…
Thanks @nobkd for the quick turnaround.