window is not defined
After doing all the necessary steps in the usage instructions section, only requiring stompJs leads to an error: abc.js: const WebSocket = require('websocket').w3cwebsocket; const StompJs = require('@stomp/stompjs');
$ node abc.js
c:\Users....\Desktop\node_test\node_modules@stomp\stompjs\bundles\stomp.umd.js:10
})(window, function() {
^
ReferenceError: window is not defined
at Object.
ref: https://stomp-js.github.io/guide/stompjs/2018/06/28/using-stompjs-v5.html
Please change it to:
const WebSocket = require('websocket').w3cwebsocket;
const StompJs = require('@stomp/stompjs/esm5');
I will update the instructions as well.
Updated instructions at https://stomp-js.github.io/guide/stompjs/2018/06/28/using-stompjs-v5.html
Thanks for pointing out 😄
In this case we were able to bypass it. However the underlying cause is a breaking change between webpack 3 and 4.
https://github.com/webpack/webpack/issues/6677 and https://github.com/webpack/webpack/issues/6525
I will test the workaround at https://github.com/webpack/webpack/issues/6525#issuecomment-417580843
https://github.com/webpack/webpack/issues/6525#issuecomment-417580843 seems to resolve the issue. It will be released as part of 5.1