npm

Need private packages and team management tools?Check out npm Orgs. »

single-module-instance-webpack-plugin

0.0.4 • Public • Published

Single Module Instance Webpack Plugin

At runtime webpacked module can be initialized more than once which is expected behavior for Node. Nevertheless this behavior hurts a lot if you are used to RequireJS and even may introduce unexpected singleton collisions.

SingleModuleInstanceWebpackPlugin plugin along with DedupePlugin would force require to serve only one instance of each requested module.

Update webpack.config.js with following snippet:

var SingleModuleInstancePlugin = require('single-module-instance-webpack-plugin');
 
module.exports = {
  plugins: [
    new webpack.optimize.DedupePlugin(),
    new SingleModuleInstancePlugin()
  ]
}

TODO

  • Add tests

License

The code is available under MIT licence.

install

npm i single-module-instance-webpack-plugin

Downloadsweekly downloads

37

version

0.0.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability