Skip to content

Weird error about global.WebSocket #174

@quangbuule

Description

@quangbuule
var global = (function() { return this; })();

/**
 * WebSocket constructor.
 */

var WebSocket = global.WebSocket || global.MozWebSocket;

global is undefined so, it throw error. But when I test using ws with browserify, it was window.

I am trying to use react-hot-loader and can't figure this out.

My config for entry is:

[ 
  `webpack-dev-server/client?${webpackDevServerUrl}`,
  'webpack/hot/only-dev-server',
  'src/js/index'
]

Hope someone who experienced this could help. Thanks a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions