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
We want to improve the following points:
resolveIderror is caught by Vite import analysis'stransformhook)xxx-onlyand that doesn't help much.Maybe we can delay throwing errors from
resolveIdto later stage, perhapsbuildEnd, so that we can check importer chains ofxxx-onlyand 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#L516Oh wait, the code actually changed now to use
resolveId + loadinstead. sveltejs/kit#14155