Skip to content

[codex] Improve missing Suspense flag diagnostic#8660

Open
PatrickJS wants to merge 1 commit into
build/v2from
codex/suspense-missing-flag-diagnostic
Open

[codex] Improve missing Suspense flag diagnostic#8660
PatrickJS wants to merge 1 commit into
build/v2from
codex/suspense-missing-flag-diagnostic

Conversation

@PatrickJS
Copy link
Copy Markdown
Member

Summary

Adds an early Qwik Vite transform diagnostic when a module imports Suspense from @qwik.dev/core but the app has not enabled qwikVite({ experimental: ['suspense'] }).

The new error tells the developer exactly which Vite config flag is missing and includes the file path that triggered the check.

Problem

Without the suspense experimental flag, async UI that depends on Suspense coordination can fail in a confusing way during SSR. In practice this can look like a stalled SSR request or an unrelated optimizer/runtime symptom, which sends developers looking in the wrong place.

The existing runtime error is useful when the Suspense component function actually runs, but it is too late for some dev-server paths. Catching the import during transform gives a direct configuration error before the app gets into an opaque async render state.

Changes

  • Adds a focused missing-Suspense-flag diagnostic in the Qwik Vite plugin transform.
  • Adds a unit test covering Suspense import without the experimental flag.

Validation

  • pnpm build.core
  • pnpm vitest --run packages/qwik-vite/src/plugins/plugin.unit.ts

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 22, 2026

⚠️ No Changeset found

Latest commit: c1e2a7b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@maiieul maiieul moved this to In progress in Qwik Development May 22, 2026
@PatrickJS PatrickJS marked this pull request as ready for review May 22, 2026 15:46
@PatrickJS PatrickJS requested a review from a team as a code owner May 22, 2026 15:46
@maiieul maiieul moved this from In progress to Waiting For Review in Qwik Development May 22, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8660

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8660

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8660

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8660

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@8660

commit: c1e2a7b

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ❌ Failed (View Log) c1e2a7b

Copy link
Copy Markdown
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds another full code scan on every transform, while I think it could instead be done in the Suspense component when trying to use it?

@PatrickJS
Copy link
Copy Markdown
Member Author

I think @Varixo said there was a better error in his branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting For Review

Development

Successfully merging this pull request may close these issues.

3 participants