
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-asyncmodule-tool
Advanced tools
react-asyncmodule related method.
npm install react-asyncmodule-tool
Es6 used.
import {
createCollect,
createAssets,
getChunkAssets
} from 'react-asyncmodule-tool';
options的属性
| Name | Type | Default | Description |
|---|---|---|---|
| chunkName | string or array | - | 当前 chunk 的名称,根据该值获取对应的资源文件,若为空则返回入口相关资源 |
| stats | object | - | 必填,webpack 构建生成的 stats,推荐使用 webpack-stats-plugin提取 |
| outputPath | string | stats 的 outputPath | 工程构建后 client 端的资源文件路径 |
| entrypoints | string or array | 工程的 entry | 入口文件 |
| asyncChunkKey | string | - | client 端获取依赖 chunk 的 domid |
| runtimeName | string or array | 'runtime' | 从入口文件分离出的 runtime js文件 |
const collect = createCollect({
stats,
chunkName: 'home'
});
collect.getScripts(); // 返回 chunk 所需的脚本,含 async
collect.getStyles(); // 返回 chunk 所需的样式
collect.getInlineStyles().then((data) => { // 返回内联的样式
console.log(data);
});
runtimeName一般不需要配置,使用默认值即可,如果有修改,则需要传入对应的 runtimeChunk 的名称,有多个 runtimeChunk 则传入数组,具体说明详见webpack runtime。
Serialized resource path based on the webpack's chunks
const assets = createAssets(stats);
// output
{
a: {
js: ['/public/a.js'],
css: ['/public/a.css']
},
b: {
js: ['/public/common.js', '/public/b.js'],
css: ['/public/common.css', '/public/b.css']
}
}
Output chunkNames according to matchRoutes.
getChunkAssets({
a: {
js: ['/public/a.js'],
css: ['/public/a.css']
},
b: {
js: ['/public/common.js', '/public/b.js'],
css: ['/public/common.css', '/public/b.css']
}
}, 'a');
// output
{
js: '<script type="text/javascript" src="/public/a.js"></script>',
css: '<link href="/public/a.css" rel="stylesheet">'
}
FAQs
react asyncmodule tool
We found that react-asyncmodule-tool 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.