global is undefined? unable to start RHL
See original GitHub issueI have an express server that serves my html from :3111. I also start a webpack dev server (copied from https://github.com/gaearon/react-hot-boilerplate/blob/master/server.js) on :3000. in my html, I load localhost:3000/script.js
// webpack.config.js
var webpack = require('webpack'),
path = require('path');
module.exports = {
devtool: 'eval',
target: 'web',
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000', // WebpackDevServer host and port
'webpack/hot/only-dev-server',
'./editor/index.js'
],
output: {
path: path.join(__dirname, 'public'),
filename: 'editor.js',
publicPath: '/'
},
module: {
loaders: [{
test: /\.js$/,
// exclude: /node_modules/,
loaders: ['react-hot', 'envify-loader', 'babel-loader']
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
// server.js
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
var wconfig = require('./webpack.config');
new WebpackDevServer(webpack(wconfig), {
publicPath: wconfig.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(3000, 'localhost', err => console.log(err || 'webpack at localhost:3000'));
It seems to compile alright

When I start the app, it bails almost immediately, saying Uncaught TypeError: Cannot read property 'WebSocket' of undefined (because global is undefined)

Anything I need to do on my express server/html to make this work?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
1905419 – global registration fails with ERROR
Summary: global registration fails with ERROR: undefined method '#login' for NilClass:... Keywords: Reopened, Triaged. Status: CLOSED NOTABUG.
Read more >unknown error: Chrome failed to start: exited abnormally ...
It is failing to start due to a mismatch between the chrome version and the chromedriver version. Downloading and installing the same versions ......
Read more >Server Connector - Visual Studio Marketplace
A Visual Studio Code extension for interacting with Red Hat Servers and Runtimes. Commands and features. screencast. This extension depends on ...
Read more >Error while building host using `PXEGrub2 global default ...
Rendering the template fails with: "Unable to render PXEGrub2 template 'PXEGrub2 global default': undefined method `each' for nil:NilClass".
Read more >Network Debug and Troubleshooting Guide
The unable to open shell message means that the ansible-connection daemon has not been able to successfully talk to the remote network device....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You’ll want to uncomment
exclude: /node_modules/,because some of the scripts used by hot module replacement machinery will not work with Babel out of the box.Set the valid target thing for webpack.