How do we import stompjs in a browser? Or something like stompjs?
<p>I am trying to follow <a href="https://spring.io/guides/gs/messaging-stomp-websocket/" rel="noreferrer">this</a> <code>Spring</code> tutorial on how to use <code>websockets</code>.  I am using <code>webpack</code> to bundle my code and <code>babel</code> to convert it from <code>ES6</code>.  I am trying to pull in <code>sockjs</code> with a normal <code>import</code> statement.</p>

<pre><code>import SockJS from 'sockjs'
</code></pre>

<p>But when <code>webpack</code> runs, I get missing module errors,</p>

<pre><code>ERROR in ./~/stompjs/lib/stomp-node.js
Module not found: Error: Cannot resolve module 'net' in /Users/name/Developer/cubs-stack-4/cubs-webapp/node_modules/stompjs/lib
 @ ./~/stompjs/lib/stomp-node.js 14:8-22

ERROR in ./~/websocket/package.json
Module parse failed: /Users/name/Developer/cubs-stack-4/cubs-webapp/node_modules/websocket/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
|   "_args": [
|     [
|       "websocket@latest",
 @ ./~/websocket/lib/version.js 1:17-43
</code></pre>

<p>mainly because it is expecting to be run on <code>Node</code>.  </p>

<p>I have 2 questions.  </p>

<p>First, how do I get <code>stompjs</code> into my browser side code using an <code>import/require</code> statement?</p>

<p>Second, how come in the tutorial, they can drop <code>stompjs</code> in the <code>HEAD</code> and it doesn't blow up in the browser, but it does when I run the "same" code through <code>webpack</code>?</p>