From 7e44de2da91764bb2c619ecd88b241c51ab483b0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 25 Dec 2022 13:44:09 +0100 Subject: [PATCH] web: ignore d3 circular deps warning, treat unresolved import as error Signed-off-by: Jens Langhammer --- web/rollup.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/rollup.config.js b/web/rollup.config.js index 129c67c02..18ae58cb0 100644 --- a/web/rollup.config.js +++ b/web/rollup.config.js @@ -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)