From ecd242acfa1500a397f08389cbe079d7bc59e41c Mon Sep 17 00:00:00 2001 From: Dave Page Date: Fri, 29 May 2026 10:03:22 +0100 Subject: [PATCH] fix(webpack): alias react-checkbox-tree to its ESM bundle react-checkbox-tree v2 marks the package as "type": "module" but its "require" exports condition still points at a UMD bundle. babel-loader turns our ESM imports into require() calls, so webpack picks the UMD file and treats it as ESM (because of "type": "module"). The UMD wrapper's module.exports = factory(...) never runs in that context, and the default export ends up undefined - causing CheckBoxTree to render "Element type is invalid" in dialogs like Import/Export Servers. Alias react-checkbox-tree to its ESM bundle (lib/index.esm.js, exposed by the package's own "./*": "./*" exports map) so webpack picks the file that actually has a default export. Closes #9972 --- web/webpack.shim.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/webpack.shim.js b/web/webpack.shim.js index 16b7bbf55a7..c370b31af72 100644 --- a/web/webpack.shim.js +++ b/web/webpack.shim.js @@ -44,6 +44,13 @@ let webpackShimConfig = { 'graphlib': path.join(__dirname, 'node_modules/graphlib'), 'react': path.join(__dirname, 'node_modules/react'), 'react-dom': path.join(__dirname, 'node_modules/react-dom'), + // react-checkbox-tree v2 marks the package as "type": "module" but ships + // a UMD bundle as its CommonJS entry point. Babel transforms our ESM + // imports to require(), so webpack picks the UMD file and then treats it + // as ESM (because of "type": "module") — and module.exports never runs, + // leaving the default export undefined. Point directly at the ESM bundle + // to bypass the broken main entry. + 'react-checkbox-tree$': path.join(__dirname, 'node_modules/react-checkbox-tree/lib/index.esm.js'), 'stylis': path.join(__dirname, 'node_modules/stylis'), 'popper.js': path.join(__dirname, 'node_modules/popper.js'),