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.
webpack.config.js with following snippet:
var SingleModuleInstancePlugin = ;moduleexports =plugins:
- Add tests
The code is available under MIT licence.