Skip to content
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

[1/3] [v3] Exclude codemirror/... and codemirror-graphql/... imports from bundle #3824

Merged
merged 5 commits into from
Dec 14, 2024

Conversation

dimaMachina
Copy link
Collaborator

@dimaMachina dimaMachina commented Dec 13, 2024

These files absolutely shouldn't be included in dist, they should rely on an installed version from node_modules

before

 dmytro@MacBook-Pro-9  ~/Desktop/GUILD/graphiql   do-not-bundle-codemirror  yarn workspace @graphiql/react build
yarn workspace v1.22.22
yarn run v1.22.22
$ rimraf dist types
$ tsc --emitDeclarationOnly && vite build
vite v5.3.6 building for production...
✓ 178 modules transformed.
dist/style.css                53.95 kB │ gzip: 10.24 kB
dist/forEachState.cjs.js       0.42 kB │ gzip:  0.25 kB │ map:   0.82 kB
dist/mode-indent.cjs.js        0.45 kB │ gzip:  0.28 kB │ map:   0.88 kB
dist/mode.cjs.js               0.89 kB │ gzip:  0.44 kB │ map:   1.66 kB
dist/codemirror.cjs.js         1.01 kB │ gzip:  0.50 kB │ map:   0.13 kB
dist/lint.cjs2.js              1.03 kB │ gzip:  0.49 kB │ map:   1.75 kB
dist/matchbrackets.cjs.js      1.07 kB │ gzip:  0.51 kB │ map:   0.13 kB
dist/hint.cjs.js               1.64 kB │ gzip:  0.67 kB │ map:   2.90 kB
dist/mode.cjs3.js              2.46 kB │ gzip:  0.86 kB │ map:   3.96 kB
dist/mode.cjs2.js              2.69 kB │ gzip:  0.95 kB │ map:   4.40 kB
dist/jump-to-line.cjs.js       2.79 kB │ gzip:  1.16 kB │ map:   3.74 kB
dist/info-addon.cjs.js         4.48 kB │ gzip:  1.26 kB │ map:   8.13 kB
dist/jump.cjs.js               4.78 kB │ gzip:  1.35 kB │ map:   9.03 kB
dist/SchemaReference.cjs.js    5.52 kB │ gzip:  1.28 kB │ map:  10.55 kB
dist/brace-fold.cjs.js         5.59 kB │ gzip:  1.70 kB │ map:   8.37 kB
dist/dialog.cjs.js             5.88 kB │ gzip:  1.63 kB │ map:   8.82 kB
dist/hint.cjs2.js              5.96 kB │ gzip:  1.80 kB │ map:  11.72 kB
dist/matchbrackets.cjs2.js     6.51 kB │ gzip:  1.86 kB │ map:  11.50 kB
dist/info.cjs.js               6.75 kB │ gzip:  1.33 kB │ map:  12.02 kB
dist/closebrackets.cjs.js      8.18 kB │ gzip:  2.29 kB │ map:  13.18 kB
dist/lint.cjs3.js              8.96 kB │ gzip:  2.53 kB │ map:  17.83 kB
dist/comment.cjs.js            9.81 kB │ gzip:  2.53 kB │ map:  16.04 kB
dist/lint.cjs.js              10.96 kB │ gzip:  3.08 kB │ map:  17.47 kB
dist/foldgutter.cjs.js        11.45 kB │ gzip:  2.92 kB │ map:  18.38 kB
dist/search.cjs.js            12.92 kB │ gzip:  3.25 kB │ map:  20.80 kB
dist/searchcursor.cjs.js      13.14 kB │ gzip:  3.00 kB │ map:  21.71 kB
dist/show-hint.cjs.js         21.30 kB │ gzip:  5.41 kB │ map:  34.36 kB
dist/sublime.cjs.js           28.64 kB │ gzip:  6.18 kB │ map:  47.82 kB
dist/javascript.cjs.js        43.37 kB │ gzip:  8.38 kB │ map:  69.48 kB
dist/index.js                174.59 kB │ gzip: 35.13 kB │ map: 339.97 kB
dist/codemirror.cjs2.js      404.00 kB │ gzip: 84.15 kB │ map: 682.18 kB
dist/style.css               53.95 kB │ gzip: 10.24 kB
dist/forEachState.es.js       0.40 kB │ gzip:  0.24 kB │ map:   0.81 kB
dist/mode-indent.es.js        0.44 kB │ gzip:  0.28 kB │ map:   0.88 kB
dist/mode.es.js               0.77 kB │ gzip:  0.43 kB │ map:   1.54 kB
dist/lint.es2.js              0.95 kB │ gzip:  0.47 kB │ map:   1.70 kB
dist/codemirror.es.js         0.99 kB │ gzip:  0.50 kB │ map:   0.12 kB
dist/matchbrackets.es.js      1.04 kB │ gzip:  0.51 kB │ map:   0.13 kB
dist/hint.es.js               1.55 kB │ gzip:  0.66 kB │ map:   2.81 kB
dist/mode.es3.js              1.94 kB │ gzip:  0.83 kB │ map:   3.74 kB
dist/mode.es2.js              2.15 kB │ gzip:  0.92 kB │ map:   4.17 kB
dist/jump-to-line.es.js       2.79 kB │ gzip:  1.17 kB │ map:   3.71 kB
dist/info-addon.es.js         4.29 kB │ gzip:  1.25 kB │ map:   8.01 kB
dist/jump.es.js               4.66 kB │ gzip:  1.38 kB │ map:   8.77 kB
dist/SchemaReference.es.js    5.40 kB │ gzip:  1.30 kB │ map:  10.29 kB
dist/brace-fold.es.js         5.59 kB │ gzip:  1.70 kB │ map:   8.37 kB
dist/dialog.es.js             5.86 kB │ gzip:  1.63 kB │ map:   8.81 kB
dist/hint.es2.js              5.90 kB │ gzip:  1.81 kB │ map:  11.50 kB
dist/matchbrackets.es2.js     6.48 kB │ gzip:  1.85 kB │ map:  11.49 kB
dist/info.es.js               6.72 kB │ gzip:  1.36 kB │ map:  11.76 kB
dist/closebrackets.es.js      8.18 kB │ gzip:  2.29 kB │ map:  13.17 kB
dist/lint.es3.js              8.97 kB │ gzip:  2.54 kB │ map:  17.68 kB
dist/comment.es.js            9.81 kB │ gzip:  2.53 kB │ map:  16.03 kB
dist/lint.es.js              10.97 kB │ gzip:  3.08 kB │ map:  17.46 kB
dist/foldgutter.es.js        11.43 kB │ gzip:  2.92 kB │ map:  18.37 kB
dist/search.es.js            12.92 kB │ gzip:  3.24 kB │ map:  20.77 kB
dist/searchcursor.es.js      13.12 kB │ gzip:  3.01 kB │ map:  21.71 kB
dist/show-hint.es.js         21.30 kB │ gzip:  5.41 kB │ map:  34.35 kB
dist/sublime.es.js           28.64 kB │ gzip:  6.18 kB │ map:  47.81 kB
dist/javascript.es.js        43.36 kB │ gzip:  8.38 kB │ map:  69.47 kB
dist/index.mjs              164.98 kB │ gzip: 34.41 kB │ map: 335.28 kB
dist/codemirror.es2.js      403.94 kB │ gzip: 84.14 kB │ map: 682.16 kB
✓ built in 1.86s
✨  Done in 6.31s.
✨  Done in 6.58s.

now

 dmytro@MacBook-Pro-9  ~/Desktop/GUILD/graphiql   do-not-bundle-codemirror ±✚  yarn workspace @graphiql/react build
yarn workspace v1.22.22
yarn run v1.22.22
$ rimraf dist types
$ tsc --emitDeclarationOnly && vite build
vite v5.3.6 building for production...
✓ 125 modules transformed.
dist/style.css   53.95 kB │ gzip: 10.24 kB
dist/index.js   174.72 kB │ gzip: 35.47 kB │ map: 338.57 kB
dist/style.css   53.95 kB │ gzip: 10.24 kB
dist/index.mjs  165.10 kB │ gzip: 34.43 kB │ map: 334.76 kB
✓ built in 931ms
✨  Done in 4.81s.
✨  Done in 5.06s.

Copy link

changeset-bot bot commented Dec 13, 2024

🦋 Changeset detected

Latest commit: 398b087

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphiql/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dimaMachina dimaMachina marked this pull request as ready for review December 13, 2024 17:32
@dimaMachina dimaMachina requested a review from acao December 13, 2024 17:33
Copy link
Contributor

github-actions bot commented Dec 13, 2024

The latest changes of this PR are available as canary in npm (based on the declared changesets):

@dimaMachina dimaMachina changed the title [v3] Exclude codemirror/... and codemirror-graphql/... imports from bundle [1/3] [v3] Exclude codemirror/... and codemirror-graphql/... imports from bundle Dec 13, 2024
@acao
Copy link
Member

acao commented Dec 13, 2024

looks good to me! the only important thing is that they are still bundled in graphiql.js. this is another one for the v4 release since moving it to a peer dependency is a breaking change

@dimaMachina
Copy link
Collaborator Author

dimaMachina commented Dec 13, 2024

the only important thing is that they are still bundled in graphiql.js

nothing changed with this setup

since moving it to a peer dependency is a breaking change

we don't need to move them to peer dependencies, currently they are in dependencies but they are bundled! so I removed bundling of these packages according to https://rikki.dev/posts/npm-libraries-should-not-bundle-dependencies 😄

@dimaMachina dimaMachina merged commit 72f06bc into main Dec 14, 2024
14 checks passed
@dimaMachina dimaMachina deleted the do-not-bundle-codemirror branch December 14, 2024 12:21
@acao acao mentioned this pull request Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants