package
Webpack plugin that forces require to return same instance of module regardless the place where import occurs.
npm install single-module-webpack-pluginGitHub-flavored package documentation.
Across all versions, last 30 days.
184 in 30 days
Runtime metadata.
Tagged topics.
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()
]
}The code is available under MIT licence.