Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 4 + UglifyJS Error being thrown with Plotly 1.43.1 release. #3379

Closed
morgangraphics opened this issue Dec 31, 2018 · 8 comments
Closed
Assignees

Comments

@morgangraphics
Copy link

morgangraphics commented Dec 31, 2018

Upgraded from 1.42.5 to 1.43.1

In strict mode code, functions can only be declared at top level or immediately within another function. [./node_modules/plotly.js/dist/plotly.js:70364,0]

Looks like

  var buffer = ""
    function writeBuffer() {
      if(buffer !== "") {
        var delta = context.measureText(buffer).width

        context.fillText(buffer, offsetX + xPos, offsetY + yPos)
        xPos += delta
      }
    }

is the offending function. Reverting back to 1.42.5 was the only solution.

I believe this is just an organizational issue rather than a full scale bug.

@archmoj
Copy link
Contributor

archmoj commented Dec 31, 2018

@morgangraphics Thanks for reporting.
@etpinard Wondering if that's the only module that applying strict mode may cause throwing an error?
By the way I would work on a patch to vectorize-text module to address this issue.

@archmoj
Copy link
Contributor

archmoj commented Dec 31, 2018

@morgangraphics Would you mind testing one of these?
"https://22343-45646037-gh.circle-artifacts.com/0/plotly.js"
"https://22343-45646037-gh.circle-artifacts.com/0/plotly.min.js"
If that is OK, I'll move forward and make PRs to patch modules down to the vectorize-text.

@morgangraphics
Copy link
Author

My apologies for the late reply, I was traveling last week. I'll take a look at it and report back.

@archmoj
Copy link
Contributor

archmoj commented Jan 7, 2019

That would be much appreciated.

@morgangraphics
Copy link
Author

I tried both versions of the plotly file pasted above. Minified file worked, meaning the build was successful and completed without any errors. The other file did not work, throwing an error in relation to some weird encoding.

ERROR in ./node_modules/plotly.js/dist/plotly.js 19412:33
Module parse failed: Unexpected character '€' (19412:33)
You may need an appropriate loader to handle this file type.
|     }) : [];
|   };
>   var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;
|   function d3_sgn(x) {
|     return x > 0 ? 1 : x < 0 ? -1 : 0;

@etpinard
Copy link
Contributor

etpinard commented Jan 10, 2019

Our un-minified bundle does have some non-utf-8 characters in it. But that hasn't changed in 1.43.0 😕

@morgangraphics
Copy link
Author

I'm not super concerned about the encoding as I C+P the code out of the file from the browser into my node_modules/plotlyjs/dist folder for testing. (It was the easiest and quickest way to test given my time restraints today). I think the regression issue with regards to the original bug In strict mode code, functions can only be declared at top level or immediately within another function. [./node_modules/plotly.js/dist/plotly.js:70364,0] has been addressed in code listed above.

@etpinard
Copy link
Contributor

[...] has been addressed in code listed above

Thank you very much for testing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants