Skip to content

Commit 2dc9d71

Browse files
authored
fix(webpack): alias react-checkbox-tree to its ESM bundle (#9989)
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
1 parent 27406b5 commit 2dc9d71

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

web/webpack.shim.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ let webpackShimConfig = {
4444
'graphlib': path.join(__dirname, 'node_modules/graphlib'),
4545
'react': path.join(__dirname, 'node_modules/react'),
4646
'react-dom': path.join(__dirname, 'node_modules/react-dom'),
47+
// react-checkbox-tree v2 marks the package as "type": "module" but ships
48+
// a UMD bundle as its CommonJS entry point. Babel transforms our ESM
49+
// imports to require(), so webpack picks the UMD file and then treats it
50+
// as ESM (because of "type": "module") — and module.exports never runs,
51+
// leaving the default export undefined. Point directly at the ESM bundle
52+
// to bypass the broken main entry.
53+
'react-checkbox-tree$': path.join(__dirname, 'node_modules/react-checkbox-tree/lib/index.esm.js'),
4754
'stylis': path.join(__dirname, 'node_modules/stylis'),
4855
'popper.js': path.join(__dirname, 'node_modules/popper.js'),
4956

0 commit comments

Comments
 (0)