Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools oft miss.
@module-federation/enhanced
Advanced tools
This package provides enhanced features for module federation.
@module-federation/enhanced
This package provides enhanced features for module federation.
The following items are exported:
string
The name of the container.
Exposes
undefined
Used to specify the modules and file entry points that are exposed via Module Federation. After configuration, the exposed modules will be extracted into a separate chunk, and if there are async chunks, they will also be extracted into a separate chunk (the specific splitting behavior depends on the chunk splitting rules).
The Exposes
type is defined as follows:
type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;
type ExposesItem = string;
type ExposesItems = ExposesItem[];
interface ExposesObject {
[exposeKey: string]: ExposesConfig | ExposesItem | ExposesItems;
}
Here, exposeKey
is essentially the same as the Package Entry Points specification (except that regular expression matching is not supported).
For example:
module.exports = {
plugins: [
new ModuleFederationPlugin({
name: 'mfButton',
exposes: {
// Note: "./" is not supported
'.': './src/index.tsx',
'./add': './src/utils/add.ts',
'./Button': './src/components/Button.tsx',
},
}),
],
};
This is a consumer-specific parameter. If remotes is set, it can be considered as a consumer.
Remotes
undefined
This is used to specify how Module Federation consumes remote modules.
The Remotes
type is defined as follows:
type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;
type RemotesItem = string;
type RemotesItems = RemotesItem[];
interface RemotesObject {
[remoteAlias: string]: RemotesConfig | RemotesItem | RemotesItems;
}
Here, remoteAlias
is the name actually used by the user and can be configured arbitrarily. For example, if remoteAlias
is set to demo
, the consumption method is import xx from 'demo'
.
Shared
undefined
shared
is used to share common dependencies between consumers and producers, reducing runtime download size and thus improving performance.
The Shared
type is defined as follows:
type Shared = (SharedItem | SharedObject)[] | SharedObject;
type SharedItem = string;
interface SharedObject {
[k: string]: SharedConfig | SharedItem;
}
boolean
false
Determines whether only one version of the shared module is allowed in the shared scope (singleton mode).
string
require('project/package.json')[devDeps | dep]['depName']
The required version can be a version range. The default value is the dependency version of the current application.
:::warning
When eager
is set to true, the shared dependencies will be packaged into the entry file, which will cause the entry file to be too large. Please open with caution.
eager: true
is rarely recommended
:::
boolean
false
Determines whether to load shared modules immediately.
Under normal circumstances, you need to open the asynchronous entry, and then load shared asynchronously on demand. If you want to use shared but don't want to enable asynchronous entry, you can set eager
to true .
string[]
undefined
Used to add additional plug-ins required at runtime. The value is the path of the specific plug-in. It supports absolute/relative paths and package names.
Once set, the runtime plugin is automatically injected and used at build time.
string
undefined
Used to modify the actual bundler runtime version. Path with value @module-federation/runtime-tools
.
FAQs
This package provides enhanced features for module federation.
The npm package @module-federation/enhanced receives a total of 427,367 weekly downloads. As such, @module-federation/enhanced popularity was classified as popular.
We found that @module-federation/enhanced demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools oft miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.