Static GitHub Issues

[984] trying to require 'ws' only on server side code

prev: <nuxt-child/>
next: Is it possible to watch server-side code without re-rendering client-side code?

Hello I'm failing in require only WebSocket for server side code:

plugin/apolloClient.js
  if (process.SERVER_BUILD) {
    const ws = require('ws')
    wsClient = new SubscriptionClient(wsUri, {
      reconnect: true
    }, ws)
  } else {
    wsClient = new SubscriptionClient(wsUri, {
      reconnect: true
    })
  }

nuxt.config.js
extend (config, {dev, isServer}) {
      if (!isServer) {
        config.node = {
          fs: 'empty',
          tls: 'empty'
        }
      }
    },

I receive following error warning / client and server side:

 WARNING  Compiled with 2 warnings                                                                                                                                                                  10:06:46

 warning  in ./~/bindings/bindings.js

76:22-40 Critical dependency: the request of a dependency is an expression

 warning  in ./~/bindings/bindings.js

76:43-53 Critical dependency: the request of a dependency is an expression
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This bug report is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c851">#c851</a>)</em></sub></div>