
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
asyncmodule-federation-webpack-plugin
Advanced tools
Some webpack plugin, and webpack 5+.
npm i asyncmodule-federation-webpack-plugin
const AttachedFederationPlugin = require("asyncmodule-federation-webpack-plugin");
const {
LastExportModulePlugin,
FederationRuntime
} = AttachedFederationPlugin;
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const remotes = {
app1: "http://localhost:7070/app1/remoteEntry.js"
};
// webpack.config.js
{
...
plugins: [
new ModuleFederationPlugin({
name: "test",
library: { type: "var", name: "test" },
filename: "remoteEntry.js",
remotes: remotes,
shared: {
'react': {
eager: true,
requiredVersion: "^16.3"
}
}
}),
new LastExportModulePlugin({
entryChunkName: 'server'
}),
new FederationRuntime({
remotes
}),
new AttachedFederationPlugin({
name: "test"
})
]
}
// stats.json
{
"remotesRelatedDepends": [
"webpack/container/reference/app1",
"webpack/container/remote/app1/Test",
],
"remotesMap": {
"test": [
{
"shareScope": "default",
"name": "./Test",
"externalModuleId": "webpack/container/reference/app1"
}
]
},
"exposesMap": {
"./Test": [
"test",
"common"
]
}
}
让 node 端支持异步获取 remoteEntry.js。
// webpack 编译后代码
const __webpack_modules__ = {
...
"webpack/container/reference/app1": (module) => {
"use strict";
module.exports = require('http://localhost:7070/app1/remoteEntry.js');
}
}
// 替换后
const __webpack_modules__ = {
...
"webpack/container/reference/app1": (module) => {
"use strict";
var replaceFederationRuntime = require('asyncmodule-federation-webpack-plugin').replaceFederationRuntime; module.exports = replaceFederationRuntime('http://localhost:7070/app1/remoteEntry.js');
}
}
FAQs
Federation related webpack plugin
We found that asyncmodule-federation-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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.