Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
hot-accept-webpack-plugin
Advanced tools
Simple webpack plugin to add HMR accepting code to need modules.
Webpack Version | Plugin version | Status |
---|---|---|
^5.0.0 | ^4.0.0 | ✅ |
^4.37.0 | ^4.0.0 | ✅ |
npm i -D hot-accept-webpack-plugin
yarn add -D hot-accept-webpack-plugin
import { HotAcceptPlugin } from 'hot-accept-webpack-plugin';
const { HotAcceptPlugin } = require('hot-accept-webpack-plugin');
webpack.config.js
module.exports = {
plugins: [new HotAcceptPlugin(options)]
};
test
Type: string | RegExp | (string | RegExp)[]
Required
In this example plugin will add module.hot.accept
to all modules with filename index.js
.
webpack.config.js
const { HotModuleReplacementPlugin } = require('webpack');
const { HotAcceptPlugin } = require('hot-accept-webpack-plugin');
module.exports = {
plugins: [
new HotModuleReplacementPlugin(),
new HotAcceptPlugin({
test: /index\.js$/
})
]
};
If you want to add module.hot.accept
only to one specific file, you need declare more precise path to file. You can check next example.
For example, we have the following file structure
src/index.js
src/components/TodoList.js
src/components/index.js
If we want to add module.hot.accept
only to src/index.js
, we should use following RegExp: /src\/index\.js$/
.
webpack.config.js
const { HotModuleReplacementPlugin } = require('webpack');
const { HotAcceptPlugin } = require('hot-accept-webpack-plugin');
module.exports = {
plugins: [
new HotModuleReplacementPlugin(),
new HotAcceptPlugin({
test: /src\/index\.js$/
})
]
};
webpack.config.js
const { HotModuleReplacementPlugin } = require('webpack');
const { HotAcceptPlugin } = require('hot-accept-webpack-plugin');
module.exports = {
plugins: [
new HotModuleReplacementPlugin(),
new HotAcceptPlugin({
test: 'index.js'
})
]
};
webpack.config.js
const { HotModuleReplacementPlugin } = require('webpack');
const { HotAcceptPlugin } = require('hot-accept-webpack-plugin');
module.exports = {
plugins: [
new HotModuleReplacementPlugin(),
new HotAcceptPlugin({
test: ['one-module.js', /two-module.js$/]
})
]
};
This plugin is based on modify-source-webpack-plugin.
FAQs
With ease add HMR accepting code to need modules
The npm package hot-accept-webpack-plugin receives a total of 54,863 weekly downloads. As such, hot-accept-webpack-plugin popularity was classified as popular.
We found that hot-accept-webpack-plugin 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.