
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
webpack-hmr-singleton
Advanced tools
Utility lib to help define a hot-reloadable singleton
If you want something fancier, you might want to try ud. This goal of this lib is to remain very small in scope, bytes and dependencies.
npm install webpack-hmr-singleton
var single = require('webpack-hmr-singleton');
var thing = single(module, 'thing', function() {
return { anything: ['you', 'want'] };
});
On the first run, the function will be called and single
will return the object you've specified. After every hot reload the function won't be called and you'll just get the first one back again.
This is only really useful if the value is something mutable, that you modify during the running of your program, and want it to stick around after a hot reload.
module
- The CommonJS module objectkey
- A key to identify this item, must be unique per modulefn
- A function that will return the object to singleton.Copyright 2016 Glen Mailer.
MIT Licened.
FAQs
Utility lib to help define a hot-reloadable singleton
The npm package webpack-hmr-singleton receives a total of 76 weekly downloads. As such, webpack-hmr-singleton popularity was classified as not popular.
We found that webpack-hmr-singleton demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.