Bundling of properties-panel extension doesn't work

Hi all,

I’m trying to bundle an properties-panel extension. I’ve followed the suggestions in the custom-bundle example, and using the same rollup config. However I keep getting an cannot read properties of undefined (reading 'context') even when including both bpmn-js and bpmn-js-properties-panel in the bundle. When bundling with a sourcemap it says the error originates in the bpmn.io/properties-panel/preact module when using the useContext hook.

I’ve slimmed down an example to include only the pre-bundled bpmn-js, properties-panel and the extension is the Magic example from properties panel extension example. Do you know what could be the issue?

Everything works fine if not bundled.

I’ve created a codesandbox


I guess the problem lies in the different scopes of the two bundles. As the bundled extension tried to use the renderer of the properties-panel, however, it cannot as it is out of scope for the bundled extension.

If the global variable BpmnJSPropertiesPanel, exposed by the properties-panel, is added as a global for the extension. Is still fails, but this time at the constructor of the imputs; TexxtfieldEntry [as constructor]