Skip to content

Commit

Permalink
Use built version os sockjs-client
Browse files Browse the repository at this point in the history
`webpack-dev-server` bundles `sockjs-client` from source. `sockjs-client` sources assume a node environment however, and will fail to run if `global` is not available.

By bundling `sockjs-client` from source, the node environment requirement from `sockjs-client` will also be required of the app being served and thus it is not possible to have `node.global = false` in the user app being bundled.

This fix uses the built `sockjs-client` instead of the sources.

Fix #1147
  • Loading branch information
filipesilva committed Oct 16, 2017
1 parent 32412bb commit 6222075
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/socket.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SockJS = require('sockjs-client');
const SockJS = require('sockjs-client/dist/sockjs');

let retries = 0;
let sock = null;
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/node-false-config/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

console.log('Hey.');
10 changes: 10 additions & 0 deletions test/fixtures/node-false-config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

module.exports = {
context: __dirname,
entry: './foo.js',
output: {
filename: 'bundle.js',
path: '/'
}
};
3 changes: 2 additions & 1 deletion test/fixtures/simple-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = {
output: {
filename: 'bundle.js',
path: '/'
}
},
node: false
};

0 comments on commit 6222075

Please sign in to comment.