Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nuxt] Typescript option typeCheck breaks build because of dev mode usage #632

Closed
6 tasks done
medfreeman opened this issue Nov 7, 2023 · 1 comment · Fixed by #633
Closed
6 tasks done

[Nuxt] Typescript option typeCheck breaks build because of dev mode usage #632

medfreeman opened this issue Nov 7, 2023 · 1 comment · Fixed by #633
Labels
to triage This issue needs to be triaged

Comments

@medfreeman
Copy link
Contributor

medfreeman commented Nov 7, 2023

Describe the bug

With nuxt version 3.8.0, running histoire build with typeCheck: 'build' in nuxt config, story collection fails with:

Failed to load url /@vite-plugin-checker-runtime-entry (resolved id: /@vite-plugin-checker-runtime-entry) in /home/projects/histoire-nuxt3-starter-eb2jnf-3tkfwq/node_modules/nuxt/dist/app/entry.js. Does the file exist?
Error while collecting story /home/projects/histoire-nuxt3-starter-eb2jnf-3tkfwq/components/InjectDemo.story.vue:
_0x5f2d34@https://histoirenuxt3startereb2jnf3tkf-5ud2.w-corp.staticblitz.com/blitz.5a198b5c.js:352:639283
loadAndTransform@file:///home/projects/histoire-nuxt3-starter-eb2jnf-3tkfwq/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55067:21

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: Failed to load url /@vite-plugin-checker-runtime-entry (resolved id: /@vite-plugin-checker-runtime-entry) in /home/projects/histoire-nuxt3-starter-eb2jnf-3tkfwq/node_modules/nuxt/dist/app/entry.js. Does the file exist?".] {
  code: 'ERR_UNHANDLED_REJECTION'

Furthermore, with the fix i contributed to nuxt about making vite-plugin-checker overlay work, that landed in 3.8.1, even if it resolves the error i'm reporting here, the feature (when having typeCheck: true in nuxt config) is not useful, since the errors are instantly swallowed in cli output (because story collection operates in dev mode)
the same error now happens when typeCheck: true is set and no more when typeCheck: 'build' is set.

And histoire also features type checking, so i propose disabling it entirely

The feature is still useful when running histoire dev with typeCheck: true, where the errors can be shown in the console (when disabling the overlay plugin - nuxt:type-check).

So i propose to disable the overlay to avoid errors, which is a simple fix.

After more investigations, trying to have the feature enabled in the right conditions (build, not preview, etc..) which is really complicated due to the way histoire is architectured and knowing that a ts build will stop if it can't be compiled anyway, i think it's better to disable the feature entirely to avoid errors/inconsistencies.

c.f. nuxt/nuxt#24113
c.f. nuxt/nuxt#24114

PR: #633

Reproduction

https://stackblitz.com/edit/histoire-nuxt3-starter-eb2jnf-3tkfwq?file=package.json,nuxt.config.ts,.stackblitzrc

System Info

System:
    OS: macOS 14.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 2.69 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/Library/Caches/fnm_multishells/57206_1699377468209/bin/node
    npm: 10.1.0 - ~/Library/Caches/fnm_multishells/57206_1699377468209/bin/npm
    pnpm: 8.10.2 - ~/Library/Caches/fnm_multishells/57206_1699377468209/bin/pnpm
  Browsers:
    Brave Browser: 119.1.60.110
    Chrome: 119.0.6045.105
    Safari: 17.1

Used Package Manager

pnpm

Validations

@medfreeman medfreeman added the to triage This issue needs to be triaged label Nov 7, 2023
Copy link

stackblitz bot commented Nov 7, 2023

@medfreeman medfreeman changed the title [Nuxt] Disable typeCheck, which conflicts with histoire type checking & dev mode usage for story collection [Nuxt] Typescript option typeCheck breaks build because of dev mode usage Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant