question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

minified vega-core.js causes problems

See original GitHub issue

Do you know why this is happening?

Eventually, I would like to create a single standalone html file that contains everything (css, javascript, html, etc.), but I anticipate that this issue is going to hold me back.

This html file works perfectly, without any errors:

vega-success.html

<html>
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://vega.github.io/vega/vega-core.min.js"></script>
</head>
</html>

On the other hand, this one throws an error:

vega-error.html

<html>
<head>
<script src="js/d3.v4.min.js"></script>
<script src="js/vega-core.min.js"></script>
</head>
</html>

I downloaded the files like this:

mkdir js && cd js
wget https://d3js.org/d3.v4.min.js
wget https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.8/vega-core.min.js

I’m serving the files like this:

python -m SimpleHTTPServer 8000

Here is the error (truncated because it is long):

Uncaught SyntaxError: Invalid regular expression: /[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ

Here’s what I see in my console:

localhost_8000_vega-error_html

I’m using Chrome 63.0.3239.84 on a Mac.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jheercommented, Dec 22, 2017

Thanks for raising the issue. This appears to be a character set encoding issue. Perhaps the server-provided MIME type differs from the local Python server? In any case I was able to replicate the issue, and fix by making the character set explicit:

<html>
<head>
<script src="js/d3.v4.min.js" charset="UTF-8"></script>
<script src="js/vega-core.min.js" charset="UTF-8"></script>
</head>
</html>
0reactions
jheercommented, Dec 22, 2017

UglifyJS does support an ascii-only export option that escapes unicode characters. Enabling this flag adds ~5kb to both vega.min.js and vega-core.min.js. Do we want to live with that extra 5kb? An alternative would be to update the usage documentation to use the script charset attribute. I’m leaning towards the latter, but am happy to consider any feedback on the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Minified JS causes JS to not work - Stack Overflow
I'm using carabiner for CodeIgniter which can minify all the javascript files it loads. Well, I have about ...
Read more >
Debugging JS minification bug | Better world by better software
I started to suspect that problem was caused by the concatenation step. Often different pieces of code are jammed together and if they...
Read more >
When enabling minify, some functionality is broken. How can I ...
This usually means one or more of your JavaScript files are incompatible with the minification or merging process. It can also be caused...
Read more >
Usage - Vega & Vega-Lite
To deploy Vega on the web, first import the requisite JavaScript libraries. ... Import d3 first, then import the smaller vega-core.min.js file to...
Read more >
T211881 graphoid: Code stewardship request - Wikimedia Phabricator
The issues identified were: ... Add in the risk that benchmarking the graphoid service might cause undue load to ... Minified transpiled Vega...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found