Skip to content

Enhance JS require mechanism #5253

@sukhwinder33445

Description

@sukhwinder33445

The method of the PHP class Javascript.php#optimizeDefine() manipulates the JS calls of define.js#define() to insert the full path of the script.

When implementing billboard.js, I came across the limitations of this mechanism. The regex pattern return false positives. Billboard.js (non-minified file) contains some function definitions named define(...). This mechanism also manipulates these function definitions, which leads to JS errors when trying to create charts.

Changing the regex pattern of Javascript::DEFINE_RE constant in such a way that it covers all possible call patterns is not the solution.

After discussion with @nilmerg, we have decided to create an issue so it can be improved at a later date.

To reproduce:

  1. With Introduce chart library billboard.js ipl-web#230, try to render billboard charts with _dev parameter in the url.
  2. Have a look at the browser console.

Billboard charts can be created with the reporting module by adding a report of the type ‘Host/Service Sla Chart’.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions