observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.57k stars 123 forks source link

Detect when jsDelivr is unable to bundle a package #1664

Open mbostock opened 2 months ago

mbostock commented 2 months ago

When jsDelivr fails to bundle a package, it appears to succeed, but the code is replaced with:

/**
 * Failed to bundle using Rollup v2.79.1: the file imports a not supported node.js built-in module "node:perf_hooks".
 * If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr
 */

 throw new Error('Failed to bundle using Rollup v2.79.1: the file imports a not supported node.js built-in module "node:perf_hooks". If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr');

Example: https://cdn.jsdelivr.net/npm/happy-dom/+esm

We should detect this error and abort earlier so that it’s easier to tell what went wrong. Related #956.