web: ignore d3 circular deps warning, treat unresolved import as error

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-12-25 13:44:09 +01:00
parent 08b0075335
commit 7e44de2da9
No known key found for this signature in database
1 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,9 @@ import copy from "rollup-plugin-copy";
import cssimport from "rollup-plugin-cssimport";
import { terser } from "rollup-plugin-terser";
// https://github.com/d3/d3-interpolate/issues/58
const D3_WARNING = /Circular dependency.*d3-[interpolate|selection]/;
const extensions = [".js", ".jsx", ".ts", ".tsx"];
export const resources = [
@ -95,6 +98,15 @@ export const defaultOptions = {
preserveEntrySignatures: "strict",
cache: true,
context: "window",
onwarn: function (warning, warn) {
if (D3_WARNING.test(warning)) {
return;
}
if (warning.code === "UNRESOLVED_IMPORT") {
throw Object.assign(new Error(), warning);
}
warn(warning);
},
};
// Polyfills (imported first)