minified vega-core.js causes problems
See original GitHub issueDo 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:

I’m using Chrome 63.0.3239.84 on a Mac.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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:
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
charsetattribute. I’m leaning towards the latter, but am happy to consider any feedback on the issue.