How can I solve problem with require()?


#1

Hi. I want to add a bpmn modeler in my web app and I’m trying to follow the “walkthrough” guide. I followed all the steps until
"var Modeler = require(‘bpmn-js/lib/Modeler’);

// create a modeler
var modeler = new Modeler({ container: ‘#canvas’ });"

A problem arises when I go to the browser and execute “index.html”, the file that contains the canvas container. In the console appear this error: “Uncaught Error: Module name “bpmn-js/lib/Modeler” has not been loaded yet for context: _. Use require([])”.
Given that I added “require.js” to the project, I added “[” and “]” before and after the path of required package, but the problem were partially solved, because when I run another time the web app, on the console appears this error:
“Uncaught TypeError: a.slice is not a function
at da.init (require.js:16)
at require.js:26”

The main problem is the require() instruction, but I don’t know how to solve it.

There is a way to solve it?

Thanks


#2

See my answer to another question that has been asked a few days ago: