Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Export mode as its own package #237

Closed
mfix22 opened this issue Sep 27, 2017 · 5 comments
Closed

Export mode as its own package #237

mfix22 opened this issue Sep 27, 2017 · 5 comments

Comments

@mfix22
Copy link

mfix22 commented Sep 27, 2017

We would like to consume just the GraphQL mode file. Would it be possible to release that as its own package?

@asiandrummer
Copy link
Contributor

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

@mfix22
Copy link
Author

mfix22 commented Sep 27, 2017

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 (:

@mfix22 mfix22 closed this as completed Sep 28, 2017
@mfix22 mfix22 reopened this Sep 28, 2017
@asiandrummer
Copy link
Contributor

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

@wincent
Copy link
Contributor

wincent commented Sep 28, 2017

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.

@mfix22
Copy link
Author

mfix22 commented Sep 29, 2017

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!

@mfix22 mfix22 closed this as completed Sep 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants