How to compress object when used the bpmn-js & properties-panel

Hello,

I am used the webpack (UglifyJS) to compress the code.

But the compressed code can not run, it will send error:

No provider for "e"! (Resolving: propertiesPanel -> propertiesProvider -> e)
    at m (index.esm.js:110)
    at Object.get (index.esm.js:96)
    at e (index.esm.js:150)
    at index.esm.js:169
    at Array.map (<anonymous>)
    at h (index.esm.js:165)
    at Array.v (index.esm.js:180)
    at e (index.esm.js:144)
    at index.esm.js:169
    at Array.map (<anonymous>)

How can I compress the code?

Thanks~ :slight_smile:

Ensure you annotate your services using the $inject hint:

function MyPropertiesProvider(eventBus, elementFactory) {
  // relying on eventBus, elementFactory to be found by name
}

// preserves the name meta-data upon minification
MyPropertiesProvider.$inject = [ 'eventBus', 'elementFactory' ];

Hello @nikku,

I am try to add $inject, the ‘No provider for “e”’ error is fixed.

But it has a new error:
EventBus.js:371 TypeError: o is not a function
at G.getTabs (CamundaPropertiesProvider.js:408)
at u.getTabs (DropFormPropertiesProvider.ts:30)
at C.update (PropertiesPanel.js:430)
at PropertiesPanel.js:254
at EventBus.js:480
at A._invokeListener (EventBus.js:356)
at A._invokeListeners (EventBus.js:344)
at A.fire (EventBus.js:304)
at O.setRootElement (Canvas.js:476)
at lt.add (BpmnImporter.js:102)

Is the CamundaPropertiesProvider.js will be add the same code?

Or it has other solution?

Thanks! :slight_smile:

@nikku

I saw the $inject in CamundaPropertiesProvider.js, and try to add the same $inject in my provider.

It is OK now.

Thanks~ :slight_smile:

You MUST add $inject to any component that is meant to be minified.

Cf. this StackOverflow answer for additional context.

Year, thanks! :slight_smile: