Rails 6 webpacker cannot find module for installed module : <p>in my Rails 6 project, i added jQuery pushMenu with </p>

<blockquote>
  <p>yarn add push-menu </p>
</blockquote>

<p>from <a href="https://www.npmjs.com/package/push-menu" rel="noreferrer">https://www.npmjs.com/package/push-menu</a> 
Now i can see this in node-modules folder, as push-menu. however, when i try to import or include from packs, as:</p>

<pre><code>require("push-menu")
</code></pre>

<p>i get the following error:</p>

<pre><code>Uncaught Error: Cannot find module 'push-menu'
at webpackMissingModule (application.js:12)
at Module../app/javascript/packs/application.js (application.js:12)
at __webpack_require__ (bootstrap:19)
at bootstrap:83
at bootstrap:83
</code></pre>

<p>my package.json file looks like this</p>

<pre><code>//package.json file
{
"name": "example_setup",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0-alpha",
"@rails/activestorage": "^6.0.0-alpha",
"@rails/ujs": "^6.0.0-alpha",
"@rails/webpacker": "^4.0.7",
"jquery": "^3.4.1",
"push-menu": "^2.0.8",
"select2": "^4.0.7",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.7.1"
}
}
</code></pre>

<p>What am i doing wrong here?</p>
