Open
Description
This causes the preview server to render an error on load instead of just an invalid import:
import "npm:@observablehq/does-not-exist";
And if the code block is added to an existing page, the preview server crashes!
npm:@observablehq/does-not-exist → …/framework/src/npm.ts:224
if (!response.ok) throw new Error(`unable to fetch: ${href}`);
^
Error: unable to fetch: https://data.jsdelivr.com/v1/packages/npm/@observablehq/does-not-exist/resolved
at <anonymous> (…/framework/src/npm.ts:224:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
We should catch such an error and let the import fail on the client instead.
(It’s desirable to crash the build, though, so you don’t accidentally deploy a broken site.)