Skip to content

improve server-only and client-only error message #863

@hi-ogawa

Description

@hi-ogawa

We want to improve the following points:

  • dev / build consistency
    • currently code frame is only shown during dev. (this is because resolveId error is caught by Vite import analysis's transform hook)
  • it only shows the direct importer of xxx-only and that doesn't help much.

Maybe we can delay throwing errors from resolveId to later stage, perhaps buildEnd, so that we can check importer chains of xxx-only and improve error messages. (Improving the error message for build is more important than dev. Probably we cannot do much dev anyways.)


It looks like sveltekit indeed checks their "server convention" during writeBundle. https://github.com/sveltejs/kit/blob/84298477a014ec471839adf7a4448d91bc7949e4/packages/kit/src/exports/vite/index.js#L516

Oh wait, the code actually changed now to use resolveId + load instead. sveltejs/kit#14155

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions