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

Emoji after build #2488

Closed
igrek8 opened this issue Jun 7, 2017 · 17 comments
Closed

Emoji after build #2488

igrek8 opened this issue Jun 7, 2017 · 17 comments

Comments

@igrek8
Copy link

igrek8 commented Jun 7, 2017

Not sure if this relates to emojione devs, but

We are using emojione lib to replace unicode emoji with svg/png images.

We ran into the problem when we run npm run build.
after the build, emojione fails to match emoji unicodes and stops working completely.

"☺️" OK both dev & prod environments
"😀" FAIL in prod env but OK in dev

May that be a problem due extreme uglifying or anything else I am missing?

Thanks in advance.

PS: using latest version of create react app and emojione. We

@igrek8
Copy link
Author

igrek8 commented Jun 7, 2017

I will create repo to reproduce

@igrek8
Copy link
Author

igrek8 commented Jun 7, 2017

Here we go https://github.com/crabicode/create-react-app-emoji

OK : npm start

FAIL : npm run build && serve -s build

@igrek8
Copy link
Author

igrek8 commented Jun 7, 2017

Will do diff soon,

but for now I have to download the emojione.min.js to the public/static and include script in index.html

branch to fix

@igrek8
Copy link
Author

igrek8 commented Jun 7, 2017

production -> "🕹�": "1f579
development -> "🕹️":"1f579"

Seems like some bits got missed... any ideas?

Please see diff image

@gaearon
Copy link
Contributor

gaearon commented Jun 7, 2017

Tagging as needing investigating by a motivated contributor.

@viankakrisna
Copy link
Contributor

seen a similar issue in this iamcal/js-emoji#46 it's related to UglifyJS. The solution for that issue is to add --ascii-only option in webpack's uglifyjs plugin. Maybe it would also fix this.

@BrodaNoel
Copy link
Contributor

@viankakrisna will you send a PR for that?

@tbillington
Copy link

@viankakrisna I also have an issue related to regex which I feel is caused by the uglifier. To get around I need to pass extra build args like --ascii-only. It's something that's only possible by ejecting.

@gaearon
Copy link
Contributor

gaearon commented Jun 22, 2017

@tbillington It's also possible by sending a PR that we can merge 😉

@gaearon
Copy link
Contributor

gaearon commented Jun 27, 2017

Fixed by #2596.

@gaearon gaearon closed this as completed Jun 27, 2017
@gaearon gaearon modified the milestones: 1.0.8, 1.0.x Jun 27, 2017
@gaearon
Copy link
Contributor

gaearon commented Jun 28, 2017

@igrek8
Copy link
Author

igrek8 commented Jun 28, 2017

@gaearon, Fixed & working like a charm. Thank you!

@hyperknot
Copy link

hyperknot commented Jun 30, 2017

Just to report back about this behaviour, our build grew from 530 KB to 539 KB because of this change. There is no way 9 KB worth of emoji or regex in our code. Maybe it's worth looking into a bit "softer" choice as growing 9 KB simply because of this emoji very much edge case seems like a waste of bandwidth.

@hyperknot
Copy link

OK, just did an a prettier version of both with and without ascii switch:

every occurence of is changed to \u2019.
-> \uff5c
and are \u201c and \u2018

So I'd say that this option is quite buggy right now and is changing a lot of unneeded characters. Have a look at real world results on your web apps to see how much it affects you. In my case it's 9 KB of useless escaping, so I'll keep this off.

@Timer
Copy link
Contributor

Timer commented Jun 30, 2017

@hyperknot can you please open a new issue with the contents of your last two messages? This seems pretty problematic!
It's pretty hard to track here.

@hyperknot
Copy link

#2706

@Timer
Copy link
Contributor

Timer commented Jun 30, 2017

Thanks!

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants