title: NodeJS (Server): ReferenceError: require is not defined when type: module
body: <p>On Node 13.8 I'm trying to use import / export. </p>
  
  <p>EG:
  <code>import {ChatClient, Message, MessageParser} from './chat-client/module.js';</code></p>
  
  <p>But when i do this, I get </p>
  
  <p><code>SyntaxError: Cannot use import statement outside a module</code></p>
  
  <p>So in my package.json I set <code>"type" : "module"</code> but now when I try to use <code>const io = require('socket.io-client');</code> </p>
  
  <p>I get <code>ReferenceError: require is not defined</code></p>
  
  <p>Is there a way to use import / export AND require?</p>
  
  <p>The original error, does that just mean I have to wrap my library in a NPM library? It's a Library that's used both front end and backend so using import / export is important.</p>
  
  <p>Thanks</p>