
Security News
npm Introduces minimumReleaseAge and Bulk OIDC Configuration
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.
vite-plugin-esi
Advanced tools
Vite plugin to resolve ESI with [nodesi](https://www.npmjs.com/package/nodesi).
Vite plugin to resolve ESI with nodesi.
npm i -D vite-plugin-esi
yarn add -D vite-plugin-esi
pnpm add -D vite-plugin-esi
Use the required esi option to define ESI tags to be resolved. The keys of the object are the names of the html comments that will be replaced with the resolved ESI tags.
This plugin uses html comments to determine where the ESI tags (or resolved ESI tags) should be placed.
Comments must be in the following format:
<!--vite-plugin-esi name="somename" -->
// vite.config.ts
import { defineConfig } from 'vite'
import viteEsi from 'vite-plugin-esi'
export default defineConfig({
plugins: [
viteEsi({
esi: {
headFragments: [
{ src: "http://localhost:3000/esi/fragment1" },
{ src: "http://localhost:3000/esi/fragment2" }
]
}
})
]
})
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ESI Demo</title>
<!--vite-plugin-esi name="headFragments" -->
</head>
<body>
....
</body>
</html>
| name | type | optional | default | description |
|---|---|---|---|---|
| esiOptions | NodeEsiOptions | undefined | true | n/a | Passed to nodesi. |
| esi | { [name: string]: Tag[]; } | false | n/a | |
| resolveESI | boolean | undefined | true | true | If ESI tags should be resolved to html, or to keep them as-is in the final html. |
If your production server is responsible for resolving ESI tags, you can set the resolveESI option to false to keep the tags as-is in the final html.
// vite.config.ts
import { defineConfig } from 'vite'
import viteEsi from 'vite-plugin-esi'
export default defineConfig({
plugins: [
viteEsi({
resolveESI: false,
esi: {
headFragments: [
{ src: "http://localhost:3000/esi/fragment1" },
{ src: "http://localhost:3000/esi/fragment2" }
]
}
})
]
})
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ESI Demo</title>
<!--vite-plugin-esi name="headFragments" -->
</head>
<body>
....
</body>
</html>
<!-- index.html (after build) -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ESI Demo</title>
<esi:include src="http://localhost:3000/esi/fragment1" onerror="abort"></esi:include>
<esi:include src="http://localhost:3000/esi/fragment2" onerror="abort"></esi:include>
</head>
<body>
....
</body>
</html>
FAQs
Vite plugin to resolve ESI with [nodesi](https://www.npmjs.com/package/nodesi).
The npm package vite-plugin-esi receives a total of 1,018 weekly downloads. As such, vite-plugin-esi popularity was classified as popular.
We found that vite-plugin-esi 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
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.

Research
/Security News
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.