title: How to share same instance of a class in different entry-points in webpack output
body: <p>Does importing a class in different entry-point files of webpack create a new instance of the imported class.
  Like I want to import a class <code>AJAX</code> whose instance needs to be same throughout the project in both the entry-point files.</p>
  
  <p>Right now it is used as a global object but I want to export it as module in the form of a class or object and along with maintaining the same instance in all the files.<a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/js/ajax.js" rel="nofollow noreferrer">https://github.com/phpmyadmin/phpmyadmin/blob/master/js/ajax.js</a></p>
  
  <p>This is my webpack config file emitting two different files both having this AJAX object imported.</p>
  
  <pre><code>entry: {
      db_search_new: './js/src/db_search.js',
      tbl_structure_new: './js/src/tbl_structure.js'
  },
  output: {
      filename: '[name].js',
      path: path.resolve(__dirname, 'js/dist'),
      publicPath: 'http://localhost:3007/js/dist'
  },
  </code></pre>
  
  <p>How can I achieve this using the javascript modules?
  Any idea about hot to implement this using singletons in javascript?</p>