From 194df8cc6a695597a8aea9cbf0c8f1dd4da6c6ee Mon Sep 17 00:00:00 2001 From: George Fu Date: Wed, 15 Oct 2025 13:24:10 -0400 Subject: [PATCH] chore(build): make circular imports a build error --- scripts/compilation/Inliner.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/compilation/Inliner.js b/scripts/compilation/Inliner.js index 12d4b2efdb16..fe80482a8078 100644 --- a/scripts/compilation/Inliner.js +++ b/scripts/compilation/Inliner.js @@ -180,6 +180,16 @@ module.exports = class Inliner { }, }), ], + onwarn(warning) { + /* + Circular imports are not an error in the language spec, + but reasoning about the program and bundling becomes easier. + For that reason let's avoid them. + */ + if (warning.code === "CIRCULAR_DEPENDENCY") { + // throw Error(warning.message); + } + }, external: (id) => { const relative = !!id.match(/^\.?\.?\//); if (!relative) {