v127
In v127, we improved the network waterfall by adding the dependency imports of current module in the entry module (aka. preload).
For example: https://esm.sh/[email protected]
import "https://esm.sh/stable/[email protected]/es2022/react.mjs"; /* Added in v127 */
import "https://esm.sh/v127/[email protected]/es2022/scheduler.mjs"; /* Added in v127 */
export * from "https://esm.sh/v127/[email protected]/es2022/react-dom.mjs";
export { default } from "https://esm.sh/v127/[email protected]/es2022/react-dom.mjs";
For framework authors, esm.sh provides an extra X-Esm-Deps
header that allows you to get those preload import urls.
const res = await fetch("https://esm.sh/[email protected]")
console.log(res.headers.get(`X-Esm-Deps`)?.split(", "))