Diagram-js unable to find provider e in vue production build

Hey all, thanks in advance. I’ve developed a custom editor with just diagram-js for my use case which runs it in a vue 3 app. It works great when I run it in vue-cli development mode npm run serve, but when I deployed it to my production environment I get other errors talking about a provider named e? The full error is listed below and it is thrown whenever I open a new editor,

Error: No provider for "e"! (Resolving: connectPreview -> generalizationHandler -> e)

Here is where i create the module, I don’t think I’ve done anything wrong?

sorry for some spaghetti in the code.
To reproduce right click the “Model” package on the left and select Create Class Diagram that will throw the error.

What modules does generalizationHandler depend on? Apparently it’s trying to inject an e module which I guess doesn’t exist.

So after more digging I think I am understanding what is going on. It breaks because when I build for production because it minimizes the constructor of the classes. So the provider e was actually the minimized argument name for eventBus it was just getting messed up in the parsing step. To get around this I added an explicit $injects field to GeneralizationHandler to allow it to skip parsing the constructor and just look for the injects. After that it was able to resolve the proper providers. Basically something like this

GeneralizationHandler.$inject = ['eventBus', 'elementsFactory' ...];
1 Like

The $inject property is a minification-safe way of declaring dependencies. Glad you were able to fix it!