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

Re-export all public graphql-tag exports #5861

Merged
merged 3 commits into from
Jan 27, 2020
Merged

Conversation

hwillson
Copy link
Member

Make sure we're re-exporting all public graphql-tag exports, while ensuring that valid types exist.

Make sure we're re-exporting all public `graphql-tag` exports,
while ensuring that valid types exist.
Based on how we're importing and re-exporting `graphql-tag`,
we no longer need to leverage Rollup's commonjs plugin
`namedExports` feature. Since we're also not building an ESM
bundle via Rollup, we don't need to use the commonjs plugin
for anything else, so it can be removed.
@hwillson hwillson merged commit 2a05e47 into master Jan 27, 2020
@hwillson hwillson deleted the graphql-tag-tweaks branch January 27, 2020 22:20
@abdonrd
Copy link
Contributor

abdonrd commented Jan 28, 2020

@hwillson related to this, I have send a PR to update all the graphql-tag dependencies:
apollographql/graphql-tag#272

But the repository seems a bit abandoned. Do you think you could check it out?

It would be great to later be able to export the library as ES Modules.
One proposal: apollographql/graphql-tag#273


I would like to be able to use apollo-client directly in the browser, without needing any bundle/build step.

// then re-exporting them separately, helps keeps bundlers happy without any
// additional config changes.
import gql from 'graphql-tag';
const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually just do export const { ... } = gql here, to avoid repetition.

// be fully updated to use Typescript, and these discrepancies will be fixed.

declare module 'graphql-tag' {
function gql(literals: any, ...placeholders: any[]): any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be literals: string[]?

@benjamn benjamn mentioned this pull request Jan 30, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants