-
Notifications
You must be signed in to change notification settings - Fork 842
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
Webpack bundle for Node.js? #105
Comments
On step 2 will optimize |
@EtienneLem if questions are complicated, just tell me your concern. I will find extra data for decision. |
Sorry for the delay and thanks for doing that research! 🤘
You’re right, it’s very unlikely. 👍 for removing it.
Looking at |
Fine. What do you think about this plan:
So breaking changes:
As result we will have same API and some supported browsers. If users don’t need If everythin is OK, I will start making PR after my talk in China. PR will be at beginning of September. |
Sounds good to me 👍 |
How much do you think this will lower the size of the dependency? this dependency is at the top of the list in size. $ webpack --config webpack/prod.config.js --json | webpack-bundle-size-analyzer |
@danfernand my plan is to reduce 50%. But in the first step I afraid I will be able to reduce only 10-20%. |
so im thinking of forking since I only need a subset of all the categories, i was able to get the total bundle by omitting categories that i don't care for in build data. Could making this an env variable help out to reduce bundle size. Nobody likes symbols! |
That’s a good idea, it’d be nice if we could find a way to make it easy for developers to build data from their bundler (webpack, browserify, etc) instead of |
Also, instead of calculating the data file and adding to the bundle we could push to a cdn, might be better in the long run to do that since that calculation doesn't change very much. It would reduce the bundle by more then half plus other changes you are proposing will really make this a lightweight dependency. I can help with the data file in the sky problem if you think that is a good idea. |
Maybe if data could be split from the library (#86) then it can be up to the developers to provide data the way they want, but until then I don’t think it’d be an advantage over bundling it. data needed to do a complete emoji picker is — unfortunately — huge, but even on a CDN people using the picker would still need to download it. I’d prefer not to add network into the mix, being able to use the lib offline surely is a must for most. If we do make it so data generation is customizable when bundling, we’d be just a few steps away from #86. Would then be pretty trivial for developers to download a data file from a CDN 😄 |
Hi. I replaced webpack tasks on babel for dist build in #108 |
@EtienneLem I asked @Muffassa to help us with this issue by my plan. |
@EtienneLem PR from @Muffassa was finished. When you will accept it, I will try to remove |
Seems right now date/index.js is not processed by babel and broke node env (jest tests for example as jest dont compile to commonjs whole node_module tree). But that behaviour could be fixed by changing data/index.js generation to commonjs module format and marking measure-scrollbar in jest like
|
Also seems that in dist without webpack generation EMOJI_DATASOURCE_VERSION is absent. It is provided by webpack define plugin on build time. |
@davojta thanks for this issue. I fixed them and few others in #110. But I didn’t understand your suggestion about @EtienneLem also, this time I made an integration test :). I copied dev version to |
@ai It's not suggestion, it's issue on my project and linked how babel-jest process dependencies for node_modules ( just for deep level 1 it babelifyes the modules - other required modules ( with level 2 and more in dependency graph) is not processed. I can provide repo example for the issue. Thank you to pay attention to my feedback! |
@davojta can you check EmojiMart from my PR? Maybe I fixed problem :D |
@ai yes it will fix the problem with default backgroundImageFn and with data/index.js But if webpack will be used to process SVG we will have error - i've used ReactSVG to eliminate the problem - davojta@8fa705f |
The bundle size is still 618kb after build, what am I missing here? |
After Uglify and gzip? |
after using react-scripts (create-react-app) to build minified js I don't know about Uglify and gzip, should I configure something else? |
You got different number. Size Limit shows size after UglifyJS and gzip. Just ignore difference, everything is fine. But reading about UglifyJS and gzip is always good. |
For next steps of reducing size I need the decision from you.
Right now EmojiMart bundle everything including dependencies to webpack bundle at
dist/emoji-mart.js
anddist/emoji-mart.min.js
. As result we have 3 problems:core-js
they anyway will have 2core-js
copies — one from their dependencies, second from EmojiMart. The main problem thatcore-js
is really big. About 10% of the current EmojiMart bundle.My plan of size optimization:
dist/
, but don’t bundle them into the single file.package.json
’smain
will target todist/index.js
. Anyway, most of React users have webpack or other bundlers.dist/emoji-mart.min.js
for backward compatibility, but do not use this file inpackage.json
’smain
.core-js
and all other dependencies will be inpackage.json
dependencies
and required withrequire('core-js')
. So we will use samecore-js
as the user already has.babel-plugin-transform-react-remove-prop-types
.process
and rewrite it, so webpack will not insertprocess
polyfill.Question for @EtienneLem:
dist/emoji-mart.min.js
? I understand this file for jQuery plugins, etc. But it is extremely rare to use React without any bundler.core-js
? Maybe we can rewrite code, that uses some ES6 classes? Or just put the warning to docs, if you need to support IE 11, please addcore-js
(for example, we do not send hugecore-js
to everyone, we send it only to IE 11 users).The text was updated successfully, but these errors were encountered: