Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Provide a browser bundle suitable for direct browser consumption #47

Closed
schrepfler opened this issue Nov 15, 2016 · 7 comments
Closed

Comments

@schrepfler
Copy link
Contributor

Noticed the client uses require which makes sense if one uses it on node or via browserify/build tools. What if we also expose a browser bundle for the client which already ships everything packaged so that it's possible to reference the library directly via https://unpkg.com?

@stubailo
Copy link
Contributor

@schrepfler if you could send a PR with a script that uses Webpack or Browserify to generate a bundle so that we can use unpkg, that would be great!

@ozyman42
Copy link

I use unpkg all the time. This would be really helpful!

@schrepfler
Copy link
Contributor Author

I think this is the basis #48 but I need some validation as to 1) is the generated bundle consumable from a </script> tag and will the configuration publish the bundle onto npm or do I need to add more stuff to the package.json (I'm not really a JS dev so all this module mumbo jumbo seems a bit like black magic.)

@schrepfler
Copy link
Contributor Author

Although I think we merged the support for this, I can see https://unpkg.com/subscriptions-transport-ws@0.5.3 contains require statements (which I don't have locally.)
ex. locally the client.js transpiled bundle starts with

var SubscriptionsTransportWs =
/******/ (function(modules) { // webpackBootstrap
/******/        // The module cache
/******/        var installedModules = {};

/******/        // The require function
/******/        function __webpack_require__(moduleId) {

/******/                // Check if module is in cache
/******/                if(installedModules[moduleId])
/******/                        return installedModules[moduleId].exports;

/******/                // Create a new module (and put it into the cache)
/******/                var module = installedModules[moduleId] = {
/******/                        i: moduleId,
/******/                        l: false,
/******/                        exports: {}
/******/                };

@schrepfler
Copy link
Contributor Author

Actually, there seems to have been a regression, 0.5.2 was generating a different output: https://unpkg.com/subscriptions-transport-ws@0.5.2

@schrepfler
Copy link
Contributor Author

Went through the changes for 0.5.3 and noticed the change in use of unpkg and that I need to explicitly use https://unpkg.com/subscriptions-transport-ws@0.5.3/browser/client.js
I think this beats the purpose of the "browser" node which should specify the default browser main entry point, if that was kept as-is https://unpkg.com/subscriptions-transport-ws@0.5.3 would be enough to specify?

@Urigo Urigo closed this as completed May 19, 2017
@Urigo
Copy link
Contributor

Urigo commented May 19, 2017

Fixed in 0.5.1.

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

4 participants