single-module-webpack-plugin

0.0.2 • Public • Published

Single Module Webpack Plugin

npm version

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.

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

The plugin is a fork of SingleModuleInstanceWebpackPlugin

Update webpack.config.js with following snippet:

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

TODO

  • Add tests

License

The code is available under MIT licence.

Package Sidebar

Install

npm i single-module-webpack-plugin

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jasonlaster11