title: Unexpected token error from node module import
body: <p>I have a node app that uses the WebSocket lib (<a href="https://github.com/websockets/ws" rel="nofollow noreferrer"><code>ws</code></a>) and I'm able to run this app on the local machine. </p>
  
  <p>However, when I publish it to Azure App Service, I get the following error for the same code. </p>
  
  <p>I've checked that both are running the same version of node 12.13.0, I've done <code>npm install</code> and the packages appear to be the same (they're also included when publishing anyways). And the error below is actually complaining about a file from the <code>ws</code> module.</p>
  
  <p>The line of code that triggers this error is: <code>var WebSocket = require('ws');</code></p>
  
  <pre><code>Wed Dec 04 2019 13:03:04 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
  SyntaxError: Unexpected token {
      at exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:373:25)
      at Object.Module._extensions..js (module.js:416:10)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Module.require (module.js:353:17)
      at require (internal/module.js:12:17)
      at Object.&lt;anonymous&gt; (D:\home\site\wwwroot\node_modules\ws\index.js:3:19)
      at Module._compile (module.js:409:26)
      at Object.Module._extensions..js (module.js:416:10)
  Application has thrown an uncaught exception and is terminated:
  SyntaxError: Unexpected token {
      at exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:373:25)
      at Object.Module._extensions..js (module.js:416:10)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Module.require (module.js:353:17)
      at require (internal/module.js:12:17)
      at Object.&lt;anonymous&gt; (D:\home\site\wwwroot\node_modules\ws\index.js:3:19)
      at Module._compile (module.js:409:26)
      at Object.Module._extensions..js (module.js:416:10)
  </code></pre>