Special characters in plotly.js causing minification and packaging issues
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
I have identified an issue in the plotly.js library where special characters, such as σ and μ, are used in a function. This leads to problems during the minification/packaging process, causing certain package managers to fail as they do not correctly interpret these characters.
I found a related issue in the Parcel bundler repository, which has been addressed and fixed. The details can be found here: Parcel Issue #9370
I propose modifying the original plotly.js function to replace the special characters with safer alternatives. Below is the suggested modification:
normal: function(mu, sigma) {
var n = arguments.length;
if (n < 2) sigma = 1;
if (n < 1) mu = 0;
return function() {
var x, y, r;
do {
x = Math.random() * 2 - 1;
y = Math.random() * 2 - 1;
r = x * x + y * y;
} while (!r || r > 1);
return mu + sigma * x * Math.sqrt(-2 * Math.log(r) / r);
};
},
I will try to push a PR myself
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the plotly.js source for the normal function using the mu and sigma parameters, then review the related Parcel issue for the packaging context. Replace the problematic special-character identifiers with the proposed safer names and verify that minification and packaging no longer fail.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100