Skip to content

Comments

fix: return null instead of throwing on unresolved modules in resolveId#273

Merged
thejackshelton merged 3 commits intoQwikDev:mainfrom
Kenzo-Wada:fix/return-null-resolveid
Jan 30, 2026
Merged

fix: return null instead of throwing on unresolved modules in resolveId#273
thejackshelton merged 3 commits intoQwikDev:mainfrom
Kenzo-Wada:fix/return-null-resolveid

Conversation

@Kenzo-Wada
Copy link
Contributor

The resolveId hook currently throws an error when it cannot resolve a module. Per the Rollup plugin spec, it should return null to let other plugins or Vite handle the resolution.

This fixes builds in multi-framework projects where non-Qwik modules are imported from .astro files.

// Before
const resolved = await this.resolve(id, importer);
if (!resolved) {
  throw new Error(`Could not resolve ${id} from ${importer}`);
}

// After
const resolved = await this.resolve(id, importer);
if (!resolved) {
  return null;
}

Note: This PR also includes some lint/formatter fixes.

Copilot AI review requested due to automatic review settings January 29, 2026 03:11
@changeset-bot
Copy link

changeset-bot bot commented Jan 29, 2026

🦋 Changeset detected

Latest commit: fa1b533

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@qwikdev/astro Major

Not sure what this means? Click here to learn what changesets are.

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the resolveId hook to follow the Rollup plugin specification by returning null instead of throwing an error when a module cannot be resolved. This enables proper module resolution in multi-framework projects where non-Qwik modules are imported from Astro files.

Changes:

  • Modified the resolveId hook to return null instead of throwing when resolution fails
  • Applied automated formatting fixes across multiple files using Biome

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libs/qwikdev-astro/src/index.ts Changed error throw to return null in resolveId hook; applied import reordering and formatting fixes
libs/qwikdev-astro/src/virtual.d.ts Removed trailing whitespace
libs/qwikdev-astro/server.ts Reordered imports and removed trailing whitespace/comma
libs/qwikdev-astro/package.json Collapsed files array to single line
apps/demo/src/components/qwik/counter.tsx Applied consistent formatting to component definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 29, 2026

Open in StackBlitz

npm i https://pkg.pr.new/QwikDev/astro/@qwikdev/create-astro@273
npm i https://pkg.pr.new/QwikDev/astro/@qwikdev/astro@273

commit: 3c1a8d4

Copy link
Member

@thejackshelton thejackshelton left a comment

Choose a reason for hiding this comment

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

Hey @Kenzo-Wada! Thanks for the PR 🙏 .

Could we keep the error message but as a debug log instead of removed entirely? Other than that LGTM and good to merge.

@Kenzo-Wada
Copy link
Contributor Author

@thejackshelton thank you for the review! just commited fa1b533. am i doing the right thing?

@thejackshelton thejackshelton merged commit fd9074f into QwikDev:main Jan 30, 2026
29 checks passed
@Kenzo-Wada Kenzo-Wada deleted the fix/return-null-resolveid branch January 30, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants