
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.
micro-requirejs
Advanced tools
Tiny asynchronous dependency loader, that does not require modification of dependent scripts
Extremely simple and light-weight (<1KB gzipped) asynchronous resource (JavaScript and CSS) loader
If you need support of legacy (like ancient) browsers, go with micro-requirejs v1.x
<!DOCTYPE html>
<html>
<body>
...
<script src="./rjs.js"></script>
<script type="text/javascript">
rjs([
"https://code.jquery.com/jquery-3.3.1.slim.min.js",
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
])
.then(() => {
console.log( "jQuery available, Bootstrap CSS available." );
return rjs("https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js")
.then(() => {
console.log( "Bootstrap JS available." );
});
})
.catch(( err ) => {
console.error( "Something went wrong", err );
});
</script>
</body>
</html>
async function main() {
try {
await rjs([
"https://code.jquery.com/jquery-3.3.1.slim.min.js",
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
]);
await rjs( "https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" );
console.log( "jQuery and Bootstrap loaded" );
} catch ( err ) {
console.error( err );
}
}
main();
// Single source
await rjs( "https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js", {
integrity: "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy",
crossorigin: "anonymous"
});
// Multiple sources
await rjs([
["https://code.jquery.com/jquery-3.3.1.slim.min.js", {
integrity: "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo",
crossorigin: "anonymous"
}],
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
]);
You can run tests like that:
npm test
FAQs
Tiny asynchronous dependency loader, that does not require modification of dependent scripts
The npm package micro-requirejs receives a total of 8 weekly downloads. As such, micro-requirejs popularity was classified as not popular.
We found that micro-requirejs 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.