Giter Site home page Giter Site logo

Comments (24)

bramchi avatar bramchi commented on July 21, 2024 1

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:

import { NimblePicker } from 'emoji-mart'
import { NimblePicker } from 'emoji-mart/dist-es'
import NimblePicker from 'emoji-mart/dist/components/picker/nimble-picker'
import NimblePicker from 'emoji-mart/dist-es/components/picker/nimble-picker'

Any ideas/suggestions for a patch/solution are welcome 😄
Or is Webpack 3 not supported? Current situation doesn't allow me to upgrade to Webpack 4.

from emoji-mart.

savardc avatar savardc commented on July 21, 2024

We also use the dataset separately from the picker and having an easier way to query it would be a big improvement

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

That would work for me 😄

from emoji-mart.

slvnperron avatar slvnperron commented on July 21, 2024

@samkelleher Have you done that? I also need to split data from the bundle

from emoji-mart.

samkelleher avatar samkelleher commented on July 21, 2024

@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.

from emoji-mart.

mismith avatar mismith commented on July 21, 2024

What's the status of this?

from emoji-mart.

samkelleher avatar samkelleher commented on July 21, 2024

@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.

from emoji-mart.

mismith avatar mismith commented on July 21, 2024

Gotcha, thanks for the clarification.

from emoji-mart.

nolanlawson avatar nolanlawson commented on July 21, 2024

This should be possible now?

import data from 'emoji-mart/dist/data/data.js'
import Picker from 'emoji-mart/dist/components/picker.js'

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

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.

from emoji-mart.

dmfrancisco avatar dmfrancisco commented on July 21, 2024

@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 emoji-mart v2.6.1:

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 source-map-explorer you can see that the latter (page on the right) includes both all.json and emojione.json:

emoji-mart

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

@dmfrancisco I see. Can you try import { NimblePicker } from 'emoji-mart/dist-es'? I believe to take advantage of tree-shaking it requires ES modules (which dist-es should have).

Let me know if that works, will update the docs accordingly if it does.

from emoji-mart.

dmfrancisco avatar dmfrancisco commented on July 21, 2024

I'm afraid I got the same result 😕 The demo I'm using is here and I'm testing with:

yarn build
npm install -g source-map-explorer
source-map-explorer build/static/js/main.<hash>.js

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

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
source-map-explorer:
screen shot 2018-05-24 at 12 42 22 pm

from emoji-mart.

dmfrancisco avatar dmfrancisco commented on July 21, 2024

Interesting 👍 I quickly tried to clone and build your demo and the generated main.js weighted 1.01 MiB according to webpack, while when I replaced the NimblePicker with Picker and removed the data import it reduced to 618 KiB.

But I may have done something wrong! I'll take a closer look as soon as possible.

from emoji-mart.

Kubster96 avatar Kubster96 commented on July 21, 2024

@bramchi I have the same situation, using Webpack 4.12.1

from emoji-mart.

piotrooo avatar piotrooo commented on July 21, 2024

Any news with this?

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

I just realized that this file (https://github.com/missive/emoji-mart/blob/master/src/utils/data.js) uses module.exports instead of export. I’m pretty sure that’s because this file is also used by https://github.com/missive/emoji-mart/blob/master/scripts/build.js (which doesn’t go through Babel so it was throwing when requiring).

Although utils/data.js isn’t requiring any file, is the module.exports alone enough to nullify Webpack’s tree shaking?

from emoji-mart.

bramchi avatar bramchi commented on July 21, 2024

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.
Makes for a 'whopping' 50kB smaller build... haha oh well ¯\_(ツ)_/¯

from emoji-mart.

Kubster96 avatar Kubster96 commented on July 21, 2024

@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.

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

So I just published v2.7.0 which completely removes module.exports from the dist-es folder. Hopefully that’ll help w/ Webpack tree shaking.

from emoji-mart.

peacepostman avatar peacepostman commented on July 21, 2024

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

from emoji-mart.

ajbeaven avatar ajbeaven commented on July 21, 2024

Same issue here. 2.8.1 with NimblePicker loads both all.json and {set}.json. #229 has some suggestion on how to fix.

from emoji-mart.

towfiqi avatar towfiqi commented on July 21, 2024

This is still an issue. The NimblePicker also includes the all.json file.

from emoji-mart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.