Hi there,
the current Node.js Version supports ES6 Modules natively.
All issues I found in this forum deal with bundlers as workaround.
Shouldn’t I be able to import and use bpmn-js directly within a Node.js v14.x.x application, without the detour of bundlers?
Assuming a minimal project setup as follows:
package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node index.js"
},
"devDependencies": {},
"dependencies": {
"bpmn-js": "8.2.0"
},
"author": "",
"license": "ISC"
}
index.js
import BpmnViewer from 'bpmn-js';
export default (str) => {
return str.toUpperCase();
};
Place the two files within a folder and run npm install
and npm run start
and you should recognize the following error:
I still get the follwing error:
\node_modules\bpmn-js\index.js:1
export {
^^^^^^
SyntaxError: Unexpected token 'export'
Can somebody tell me how to adapt my code to get it running?
Thanks!