Coder Social home page Coder Social logo

Comments (3)

Urigo avatar Urigo commented on June 9, 2024 1

Fixed in 0.5.3. Thanks @Vlasenko .

from subscriptions-transport-ws.

larixer avatar larixer commented on June 9, 2024

Seems module format for client-side bundle has changed from CommonJS in 0.5.1 to global var in 0.5.2 by Pull Request:
#77

Maybe libraryTarget: 'umd' should be used instead in unpkg-webpack.config.js?

Global var module style for client-side bundle will work without hacks involved only with <script> tags in web browser. But if one uses webpack bundler (maybe it is applicable for other bundlers as well), by default it processes browser field in package.json and hence attempts to use client-side bundle when you require('subscritption-transport-ws'). In 0.5.1 everything was fine with webpack, because client-side bundle had CommonJS module style. But in 0.5.2 module style changed to global var and now you need to require this module in rather convoluted way:

  require('script!subscriptions-transport-ws');
  const SubscriptionClient = SubscriptionsTransportWs.SubscriptionClient;

I propose to not use global var, but rather use the module style for client-side bundle that works BOTH with <script> tag and with bundlers. I think UMD module style is compatible with any usage scenario.

from subscriptions-transport-ws.

larixer avatar larixer commented on June 9, 2024

@Urigo The same problem has happened with 0.6.0. Browser bundle is exported as global var, whereas in 0.5.x it was exported as CommonJS module, is it intended?

from subscriptions-transport-ws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.