Issue with Next.js build and bpmn-js packages

Hello everyone, I’m currently working on a product using Next.js version 13.4.8, and I’m utilizing bpmn-js@14.0.0 alongside the propertie panel packages (@bpmn-io/properties-panel@3.13.0, bpmn-js-properties-panel@5.6.1). While everything works smoothly in development mode (using npm run dev), I’m encountering an issue when running the application using the production build (npm run build & npm run start). The app fails with a client-side error due to a syntax error in the compiled webpack chunk (see attached images). After some investigation, I’ve narrowed down the problem to the BPMN additional modules. I reuse the code as provided in the examples:

import BpmnModeler from 'bpmn-js/lib/Modeler';
import {
  BpmnPropertiesPanelModule,
  BpmnPropertiesProviderModule,
} from 'bpmn-js-properties-panel';

const modeler = new BpmnModeler({
  container: '#canvas',
  propertiesPanel: {
    parent: '#properties'
  },
  additionalModules: [
    BpmnPropertiesPanelModule,
    BpmnPropertiesProviderModule
  ]
});

As soon as I provide any additional modules the build still works fine but the site crashes with a client-side error. If I exclude them (provide an empty error), everything works as expected even in production. I suspect that the error may be occurring during the build process, resulting in a syntax error in the produced chunk (as shown in the attached image). I’ve also posted this issue in the next.js forum, but so far I haven’t been able to find a solution. I’m reaching out here in the hopes that someone might have encountered a similar issue or have insights into how to resolve it. Any help or suggestions would be greatly appreciated, as I’m struggeling with this errors for weeks and it basically stops me from shipping the editor. Thank you in advance!


Bildschirmfoto 2023-11-09 um 17.42.04

This looks like an issue unrelated to bpmn.io projects.