title: NextJS React - WebpackError: window is not defined
body: <p>I'm trying to playing around with React.
  I followed the "Getting Started" tutorial of NextJs (<a href="https://nextjs.org/learn/basics/getting-started" rel="nofollow noreferrer">link</a>) and I have successfully created the new project.</p>
  
  <p>As soon as I try to import third-party plugins like <a href="https://www.npmjs.com/package/current-device" rel="nofollow noreferrer">current-devices</a> or <a href="https://www.npmjs.com/package/smooth-scrollbar" rel="nofollow noreferrer">smooth-scrollbar</a> I get the following error:</p>
  
  <pre><code>ReferenceError: window is not defined
  (anonymous function)
  /c/xampp/htdocs/nextjs/node_modules/smooth-scrollbar/dist/smooth-scrollbar.js:1:262
  Module._compile
  module.js:652:30
  Module._extensions..js
  module.js:663:10
  Module.load
  module.js:565:32
  tryModuleLoad
  module.js:505:12
  Function.Module._load
  module.js:497:3
  Module.require
  module.js:596:17
  require
  internal/module.js:11:18
  smooth-scrollbar
  webpack:/external "smooth-scrollbar":1
  &gt; 1 | module.exports = require("smooth-scrollbar");
  View compiled
  __webpack_require__
  ./webpack/bootstrap:21
    18 | // Execute the module function
    19 | var threw = true;
    20 | try {
  &gt; 21 |  modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
       | ^  22 |  threw = false;
    23 | } finally {
    24 |  if(threw) delete installedModules[moduleId];
  View compiled
  Module../pages/index.js
  /_next/development/server/static/development/pages/index.js:221:74
  __webpack_require__
  ./webpack/bootstrap:21
    18 | // Execute the module function
    19 | var threw = true;
    20 | try {
  &gt; 21 |  modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
       | ^  22 |  threw = false;
    23 | } finally {
    24 |  if(threw) delete installedModules[moduleId];
  View compiled
  3
  /_next/development/server/static/development/pages/index.js:383:18
  __webpack_require__
  ./webpack/bootstrap:21
    18 | // Execute the module function
    19 | var threw = true;
    20 | try {
  &gt; 21 |  modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
       | ^  22 |  threw = false;
    23 | } finally {
    24 |  if(threw) delete installedModules[moduleId];
  View compiled
  ▶ 2 stack frames were collapsed.
  </code></pre>
  
  <p>The import I made in the file C:\xampp\htdocs\nextjs\pages\index.js</p>
  
  <p>is just:</p>
  
  <pre><code>import Scrollbar from 'smooth-scrollbar';
  import device from 'current-device'
  </code></pre>
  
  <p>Thanks a lot for the help!</p>