Code Monkey home page Code Monkey logo

Comments (5)

asiandrummer avatar asiandrummer commented on April 28, 2024

Hi @mfix22! Would it suffice to import codemirror-graphql/mode?

from codemirror-graphql.

mfix22 avatar mfix22 commented on April 28, 2024

We are going to use it in the browser (obviously) so we just want the import to be as small as possible.

Right now if we import codemirror-graphql/mode will only the one package get included? That might be out of the scope of this issue (:

@asiandrummer, I would just like to import this function, the one passed to CodeMirror.defineMode (:

from codemirror-graphql.

asiandrummer avatar asiandrummer commented on April 28, 2024

@mfix22 -

I would just like to import this function, the one passed to CodeMirror.defineMode

I take that you'd like to import the mode function, as well as the required imported modules that include CodeMirror and graphql-language-service-parser.

$ du -hcs node_modules/codemirror
3.2M	../codemirror
$ du -hcs node_modules/graphql-language-service-parser
 84K	../graphql-language-service-parser/
$ du -hcs node_modules/codemirror-graphql
116K	../codemirror-graphql
$ du -hcs node_modules/codemirror-graphql/mode.js
4.0K	../codemirror-graphql/mode.js

So if we just released, let's say codemirror-graphql-mode only, then we'd save around 100K (LICENSE/README/package.json takes up 12K in my calculation). Since in any case you'd have to import CodeMirror that is ~3200K already, I'd say you're not saving much.

I understand that I may not be familiar with your situation though - may I ask what your use case is? Is ~100K addition enough to hinder the performance in your web application? I'm willing to consider releasing said codemirror-graphql-mode if it's absolutely necessary under a good business use case. cc @wincent I'd like to get your input as well please!

from codemirror-graphql.

wincent avatar wincent commented on April 28, 2024

It would be desirable to tackle this at the build stage, I think: if you directly require "codemirror-graphql/mode" (and only that), you would ideally be able to bundle only that and its dependencies (which as @asiandrummer points out, are quite large). If there is some technical obstacle to that in how codemirror-graphq is structured, we should fix it (although I am not aware of any issues), but I don't think creating a separate package should be necessary.

from codemirror-graphql.

mfix22 avatar mfix22 commented on April 28, 2024

Hey guys after further thought, I am going to close this. Every scenario where I would like to use that function is for CodeMirror-y things, in which case I will already have to import CodeMirror. Thanks for the discussion!

from codemirror-graphql.

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.