
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
@wordpress/asset-loader
Advanced tools
Utility to dynamically load WordPress scripts and styles with dependency resolution.
Utility to dynamically load WordPress scripts and styles with dependency resolution.
This package provides a function to dynamically inject WordPress assets (scripts and styles) into the DOM with:
wp_enqueue_script/wp_enqueue_style behaviorInstall the module:
npm install @wordpress/asset-loader --save
import loadAssets from '@wordpress/asset-loader';
const assets = {
scripts: {
'wp-blocks': {
src: 'https://example.com/wp-includes/js/dist/blocks.min.js',
deps: [ 'wp-element', 'wp-data' ],
version: '1.0.0',
in_footer: true,
},
},
styles: {
'wp-block-library': {
src: 'https://example.com/wp-includes/css/dist/block-library/style.min.css',
deps: [],
version: '1.0.0',
media: 'all',
},
},
inline_scripts: {
before: {},
after: {
'wp-blocks': 'wp.blocks.registerBlockType(...)',
},
},
inline_styles: {
before: {},
after: {},
},
};
await loadAssets(
assets.scripts,
assets.inline_scripts,
assets.styles,
assets.inline_styles
);
import { resolveSelect } from '@wordpress/data';
import { store as coreDataStore } from '@wordpress/core-data';
import { unlock } from './lock-unlock';
import loadAssets from '@wordpress/asset-loader';
async function loadEditorAssets() {
// Get assets from the REST API endpoint
const assets = await unlock(
resolveSelect( coreDataStore )
).getEditorAssets();
// Load them into the DOM
await loadAssets(
assets.scripts || {},
assets.inline_scripts || { before: {}, after: {} },
assets.styles || {},
assets.inline_styles || { before: {}, after: {} }
);
}
Loads WordPress assets with dependency resolution.
Record<string, Script> - Map of script handles to script dataRecord<'before' | 'after', Record<string, string | string[]>> - Inline scriptsRecord<string, Style> - Map of style handles to style dataRecord<'before' | 'after', Record<string, string | string[]>> - Inline stylesPromise<void> - Resolves when all assets are loaded and executed
type Script = {
src: string;
deps?: string[];
version?: string;
in_footer?: boolean;
};
type Style = {
src: string;
deps?: string[];
version?: string;
media?: string;
};
in_footer flagasync=false for order)See CONTRIBUTING.md.
GPL-2.0-or-later
FAQs
Utility to dynamically load WordPress scripts and styles with dependency resolution.
The npm package @wordpress/asset-loader receives a total of 1,675 weekly downloads. As such, @wordpress/asset-loader popularity was classified as popular.
We found that @wordpress/asset-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 23 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.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.