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

Publish a browser specific bundle for the client #47

Closed
OmgImAlexis opened this issue Nov 4, 2020 · 7 comments · Fixed by #58
Closed

Publish a browser specific bundle for the client #47

OmgImAlexis opened this issue Nov 4, 2020 · 7 comments · Fixed by #58
Labels
enhancement New feature or request good first issue Issue tackles a good aspect released Has been released and published

Comments

@OmgImAlexis
Copy link

Any chance on a browser specific bundle being added to the build process so that it's easy to use with services like unpkg?

@enisdenjo
Copy link
Owner

The library leverages the browser field in package.json to communicate the entrypoint for a browser environment.

"browser": "lib/client.js",

If you look this lib up on unpkg following their URL structure: https://unpkg.com/graphql-ws@1.10.0 - you'll get the browser code exclusively.

@enisdenjo enisdenjo added the question Further information about the library is requested label Nov 4, 2020
@OmgImAlexis
Copy link
Author

OmgImAlexis commented Nov 4, 2020

That’s not the issue. The file still has “exports” meaning it can’t be used via a script tag.

It’s also using require in that. I was hoping for a single file with all that bundled.

@enisdenjo
Copy link
Owner

Ah, now I follow, you're interested in an AMD or UMD build. This makes sense!

I'll see what I can do and will keep you posted 👍.

@enisdenjo enisdenjo added enhancement New feature or request good first issue Issue tackles a good aspect and removed question Further information about the library is requested labels Nov 4, 2020
@sibelius
Copy link
Contributor

sibelius commented Nov 4, 2020

I think rollup could help on this one

@enisdenjo
Copy link
Owner

🎉 This issue has been resolved in version 1.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@enisdenjo enisdenjo added the released Has been released and published label Nov 4, 2020
@enisdenjo
Copy link
Owner

Heads up! As of v1.11.0, you can:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>GraphQL over WebSocket</title>
    <script
      type="text/javascript"
      src="https://unpkg.com/graphql-ws/umd/graphql-ws.min.js"
    ></script>
  </head>
  <body>
    <script type="text/javascript">
      (function () {
        const client = graphqlWs.createClient({
          url: 'wss://umdfor.the/win/graphql',
        });

        // consider other recipes for usage inspiration
      })();
    </script>
  </body>
</html>

* Plucked straight out of the lib recipes

@OmgImAlexis
Copy link
Author

Not sure it needs the IIFE but yay. 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Issue tackles a good aspect released Has been released and published
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants