-
Notifications
You must be signed in to change notification settings - Fork 806
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
Split out emoji library from emoji picker. 👻 #86
Comments
We also use the dataset separately from the picker and having an easier way to query it would be a big improvement |
That would work for me 😄 |
@samkelleher Have you done that? I also need to split data from the bundle |
@slvnperron I did actually and finished the other day, however, by the time I finished and moved things about I have something thats radically different to emoii-mart. Visually similar, but by time I had moved stuff around and generally optimised and tweaked it I essentially have something new. Need to figure out where to take it from here. |
What's the status of this? |
@mismith I need to figure out what to do since when I split out the emoji dataset to essentially recreate an emoji picker using dumb components decoubled from their dataset, it obviously is a breaking change to emoji-mart so there is no clear upgrade path or replacement. I could continue to refactor and try preserve the original interface but this would take a lot of work and I've already completed the part I needed. |
Gotcha, thanks for the clarification. |
This should be possible now? import data from 'emoji-mart/dist/data/data.js'
import Picker from 'emoji-mart/dist/components/picker.js' |
This should now be possible since v2.6.0, see section in README https://github.com/missive/emoji-mart#datasets I also noticed some places where the provided JSON for each set (in emoji-mart/data) can be optimized to reduce the size a little bit more. I’ll be updating that soon. Let me know if you have any questions regarding providing a custom data file. |
@EtienneLem That's great, thank you 👍 I think there may be something wrong with the implementation or instructions (or maybe I'm misunderstanding) though. I created an app and added import 'emoji-mart/css/emoji-mart.css';
import { Picker } from 'emoji-mart';
class App extends Component {
render() {
return (
<Picker set='emojione' />
);
}
} The js file after building weights 118.52 KB gzipped. I then followed the instructions in the readme: import 'emoji-mart/css/emoji-mart.css';
import data from 'emoji-mart/data/emojione.json';
import { NimblePicker } from 'emoji-mart';
class App extends Component {
render() {
return (
<NimblePicker set='emojione' data={data} />
);
}
} After building it now weights 183.15 KB (+64.63 KB) gzipped. Using |
@dmfrancisco I see. Can you try Let me know if that works, will update the docs accordingly if it does. |
I'm afraid I got the same result 😕 The demo I'm using is here and I'm testing with:
|
Thanks for the demo! I believe it could be an issue with Webpack config when using create-react-app, I did a demo from scratch (w/ Webpack 4) and it feels like it’s working(?): Demo: https://github.com/EtienneLem/emoji-mart-tree-shaking |
Interesting 👍 I quickly tried to clone and build your demo and the generated But I may have done something wrong! I'll take a closer look as soon as possible. |
I'm also seeing all.json show up together with twitter.json when I use the NimblePicker and set it to use the twitter.json data. Using emoji-mart 2.6.1 with webpack 3.11.0, all the following ways of importing result in all.json ánd twitter.json in the bundle:
Any ideas/suggestions for a patch/solution are welcome 😄 |
@bramchi I have the same situation, using Webpack 4.12.1 |
Any news with this? |
I just realized that this file (https://github.com/missive/emoji-mart/blob/master/src/utils/data.js) uses Although |
What I ended up doing as a workaround is cloning the package into my project and replacing all references to all.json in the component with the specific twitter.json dataset I want to use. |
@bramchi I used NimblePicker and NimbleEmoji with messanger emojis (which included all.json and messanger.json) then i replaced all.json with empty json like this {}, so eventually it decreased build by 500 kB and still i could use in Nimble components any emoji set i liked. |
So I just published v2.7.0 which completely removes |
Hello, we are still experiencing the same issue even when using NimblePicker and NimbleEmoji and specifying data import. Is anyone still in the same situation ? Webpack version is 4.12.0 and Emoji-mart is 2.7.0 |
Same issue here. 2.8.1 with NimblePicker loads both |
This is still an issue. The NimblePicker also includes the all.json file. |
Just want to get a comment form the emoji-mart contributors.
I'm going to work on a fork that will split out using Higher Order Components the rendering of the emoji-picker and the datasource.
At present, they are all bundled together, the picker imports directly the generate
data.js
file. However, I believe this complicates the the release cycle as often the underlying dataset will change more than the picker does.Secondly, in my use case, the application uses the emoji dataset elsewhere. For example, in an rich text editor autocomplete. And in string replace to replace emoji with images when viewed on a older platform, or Windows. So it doesn't make sense to have two copies of the emoji library.
Since making the changes required would likely result in an API change I wanted to get a feel for comments first before I started, especially related to component naming.
Something like:
Works as normal, uses localstorage and internal data library.
Picker
would just wrap theSimplePicker
and provide it with the internal data and localstorage functions. However, my application could consume the lower level component directly, which I've calledSimplePicker
which would expect the storage/dataset functions to be injected into it.This means that by referencing only the SimplePicker, webpack would not bundle the included emoji dataset in my application code.
Thoughts / comments? 💬
The text was updated successfully, but these errors were encountered: