Hi there,
I’m making an app with bpmn-js and reactjs. I was wondering if this is possible. I created a simple react app with a simple message, then I tried to import the bpmn-js library but as soon as I import it I got this error message in the console “Uncaught SyntaxError: Unexpected token export”. When I click on the error, it gets me to this code:
/* 61 */
/***/ (function(module, exports) {
export {
default
} from './lib/Viewer';
/***/ }),
/* 62 */
/***/
My react code just has this,
import React, { Component } from 'react';
import BpmnViewer from 'bpmn-js';
export default class App extends Component {
render() {
return (
<div>React simple starter</div>
);
}
}
If you want to know about my package.json I have included these libraries
"dependencies": {
"babel-preset-stage-1": "^6.1.18",
"bpmn-js": "^2.4.0",
"bpmn-js-properties-panel": "^0.26.1",
"camunda-bpmn-moddle": "^3.0.0",
"diagram-js": "^2.5.1",
"lodash": "^3.10.1",
"react": "16.3.2",
"react-dom": "16.3.2",
"react-redux": "5.0.7",
"redux": "4.0.0"
}
I can run examples with jquery without issue but I need to use react. Any idea what could be happening?
Thanks in advance,
Angelo
Answer
Ensure you use an ES module aware bundler to consume
bpmn-js >= 1.0
.Compatible bundlers include
Rollup
,Webpack >= 2
and others.