graphiql 5: reduce bundle size, import prettier dynamically to avoid bundling Prettier#4069
graphiql 5: reduce bundle size, import prettier dynamically to avoid bundling Prettier#4069dimaMachina merged 2 commits intomainfrom
prettier dynamically to avoid bundling Prettier#4069Conversation
🦋 Changeset detectedLatest commit: ded6246 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
The latest changes of this PR are available as canary in npm (based on the declared |
|
I'm not sure that GraphiQL itself should even embed prettier? Seems easy to add in a wrapper and something that people may or may not want (and may want to customize the options of). Happy to see the bundle size reduced though! |
|
@benjie graphql‑js' Apollo Studio formats comments too, both in the operation and variables editors. So, dynamically loading Prettier seems ok? |
|
It's a pragmatic choice for now. Longer term I'd like to see an option in GraphQL to "retain comments". Maybe we already retain them, since we used to need to read comments in order to apply descriptions to things (before a comment syntax was added), so it could be as simple as just printing them - needs investigation. |
we don't need prettier on initial loading, it's only used by clicking on format query button/shortcut
diff from vite example
cc @benjie