
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
module-federation-import-remote
Advanced tools
Allow Dynamic Imports of Remotely Exposed Modules Using Webpack Module Federation
Allow a host application to dynamically import remotely exposed modules using Webpack Module Federation
This library exports an importRemote() function which will enable dynamic imports of remotely exposed modules using the Module Federation plugin. It uses the method described in the official Webpack configuration under Dynamic Remote Containers.
new ModuleFederationPlugin({
name: "Foo",
library: { type: "var", name: "Foo" },
filename: "remoteEntry.js",
exposes: {
"./Bar": "./src/Bar",
},
})
Build the remote application and serve it so that remoteEntry.js is accessible for example in the following URL http://localhost:3001.
Load the remotely exposed module in the host application using importRemote() and use it:
import { importRemote } from "module-federation-import-remote";
// If it's a regular js module:
importRemote({ url: "http://localhost:3001", scope: 'Foo', module: 'Bar' }).then(({/* list of Bar exports */}) => {
// Use Bar exports
});
// If Bar is a React component you can use it with lazy and Suspense just like a dynamic import:
const Bar = lazy(() => importRemote({ url: "http://localhost:3001", scope: 'Foo', module: 'Bar' }));
return (
<Suspense fallback={<div>Loading Bar...</div>}>
<Bar />
</Suspense>
);
Apart from url, scope and module you can also pass additional options to the importRemote() function:
FAQs
Allow Dynamic Imports of Remotely Exposed Modules Using Webpack Module Federation
The npm package module-federation-import-remote receives a total of 3,529 weekly downloads. As such, module-federation-import-remote popularity was classified as popular.
We found that module-federation-import-remote demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.