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.

Regex error when used with a minifier that turns unicode characters into ASCII

See original GitHub issue

If ascii_only is set to true on uglify-js, react-pdf will throw the following error:

SyntaxError: invalid range in character class

Issue stems from hyphen. 1.4.1 version of this package is unusable with Create React App in its default configuration, as CRA has ascii_only set to true by default.

Here is my initial report.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
diegomuracommented, Mar 14, 2019

Thanks @oskarkook ! Otherwise we will just have to fork it and publish a new version under @react-pdf scope. Let’s wait some days or otherwise just follow that path

0reactions
oskarkookcommented, Mar 14, 2019

Current solution is to use 1.4.0. I’ve opened a PR in hyphen, but who knows if/when it will be accepted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to encode unicode characters with the pattern "\u ...
new UglifyJsPlugin({ uglifyOptions: { output: { // This was turned in the app because "emoji and regex" values // were not minified properly ......
Read more >
UTS #18: Unicode Regular Expressions
Unicode is a large character set—regular expression engines that are only adapted to handle small character sets will not scale well. Unicode ......
Read more >
uglify-js - npm
UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. Note: uglify-js supports JavaScript and most language features in ...
Read more >
API Reference - Terser
Previously known as "output options". ascii_only (default false ) -- escape Unicode characters in strings and regexps (affects directives with ...
Read more >
Regex Tutorial - Non-Printable Characters
If your regular expression engine supports Unicode, you can use \uFFFF or \x{FFFF} to insert a Unicode character. The euro currency sign occupies...
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