Skip to content

A dependency is breaking the minification step in prod-build  #5

@eric-zeng

Description

@eric-zeng

The react-typeahead-component dependency is breaking uglifyjs. It is able to build without errors, but in the browser, it causes a fatal runtime error preventing inbox-bundle.js from running.

I've traced this error back to react-typeahead-component/src/utils/get_text_direction.js, where it detects RTL languages using an enormous regex that includes Unicode characters.

I've tried including the babel-plugin-transform-es2015-unicode-regex plugin when transpiling from ES6 to ES5, but it doesn't seem to fix the issue.

Uncaught SyntaxError: Invalid regular expression: /^(?:[�-@[-`{-©«-´¶-¹»-¿×÷ʹʺ˂-ˏ˒-˟˥-˭˯-ͯʹ͵;΄΅·϶҃-҉֊֍-֏֑-ׇֽֿׁׂׅׄ؀-؇؉؊،؎-ًؚ-٬ٰۖ-ۤۧ-ۭ۰-۹ܑܰ-݊ަ-ް߫-߳߶-߹ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣ৲৳৻ਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣ૱ଁ଼ିୁ-ୄ୍ୖୢୣஂீ்௳-௺ఀా-ీె-ైొ-్ౕౖౢౣ౸-౾ಁ಼ೌ್ೢೣഁു-ൄ്ൢൣ්ි-ුූัิ-ฺ฿็-๎ັິ-ູົຼ່-ໍ༹༘༙༵༷-༽ཱ-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟᎐-᎙᐀ ᚛᚜ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៛៝៰-៹᠀-᠎ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻᥀᥄᥅᧞-᧿ᨘᨗᨛᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼᪰-᪾ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᮫-ᮭ᯦ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᳸᳹᷀-᷵᷼-᷿᾽᾿-῁῍-῏῝-῟῭-`´῾ -‍‐-
 -⁤⁨-⁰⁴-⁾₀-₎₠-₽⃐-⃰℀℁℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-⅄⅊-⅍⅐-⅟↉←-⌵⍻-⎔⎖-⏺␀-␦⑀-⑊①-⒛⓪-⚫⚭-⟿⤀-⭳⭶-⮕⮘-⮹⮽-⯈⯊-⯑⳥-⳪⳯-⳱⳹-⳿⵿ⷠ-⹂⺀-⺙⺛-⻳⼀-⿕⿰-⿻ -〄〈-〠〪-〭〰〶〷〽-〿゙-゜゠・㇀-㇣㈝㈞㉐-㉟㉼-㉾㊱-㊿㋌-㋏㍷-㍺㏞㏟㏿䷀-䷿꒐-꓆꘍-꘏꙯-ꙿꚟ꛰꛱꜀-꜡ꞈꠂ꠆ꠋꠥꠦ꠨-꠫꠸꠹꡴-꡷꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꧥꨩ-ꨮꨱꨲꨵꨶꩃꩌꩼꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ﬩﴾﴿﷽︀-︙︠-︭︰-﹒﹔-﹦﹨-﹫!-@[-`{-・¢-₩│-○-�]|�[��-��-����-��-�]|�[��-����-��-�����-�]|�[�-�]|[��][��-��-��-��-����-��-��-�����-��-������-�����-��-�]|�[�-�������-������-�������-��]|�[�-��-�]|�[�-�]|�[���-�]|�[�-��-��-��-��-��-�]|�[������-�]|�[�-�]|�[��]|�[�-��-��-��-��-��-��-����-��-��-��-�]|�[�-��-��-��-��-��-��-��-��-��-�]|�[�-��-��-��-��-�])*(?:[־׀׃׆א-תװ-״؈؋؍؛؜؞-ي٭-ٯٱ-ەۥۦۮۯۺ-܍܏ܐܒ-ܯݍ-ޥޱ߀-ߪߴߵߺࠀ-ࠕࠚࠤࠨ࠰-࠾ࡀ-ࡘ࡞ࢠ-ࢲ‏‫‮⁧יִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-﯁ﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼ﹰ-ﹴﹶ-ﻼ]|�[�-���-�����-��-��-��-��-���-�����-��-��-��-��-��-��-��-��-��-��-��-��-��-�]|�[�-�]|�[�-��-�]|�[�-��-������-��-��������-�������������-��-��-��-���-��-��-��-��-�])/: Range out of order in character class
    at RegExp (<anonymous>)
    at Object.7../neutral_chars_regexp (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at inbox-bundle.js:1
    at Object.<anonymous> (inbox-bundle.js:1)
    at Object.5.../utils/get_text_direction (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at inbox-bundle.js:1
    at Object.6../components/typeahead (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at inbox-bundle.js:1
    at Object.614.../actions/InboxActions (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at inbox-bundle.js:1
    at Object.611.../../../error (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at inbox-bundle.js:1
    at Object.616.../../../flags (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at inbox-bundle.js:1
    at Object.629.../../flags (inbox-bundle.js:1)
    at i (inbox-bundle.js:1)
    at e (inbox-bundle.js:1)
    at inbox-bundle.js:1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions