serveExternalPathPlugin() — vite Function Reference
Architecture documentation for the serveExternalPathPlugin() function in vite.config.js from the vite codebase.
Entity Profile
Dependency Diagram
graph TD c994e6fd_ed68_3935_db70_4c49f3b25a03["serveExternalPathPlugin()"] 9a8c5733_b375_931b_205b_d252f571a766["vite.config.js"] c994e6fd_ed68_3935_db70_4c49f3b25a03 -->|defined in| 9a8c5733_b375_931b_205b_d252f571a766 style c994e6fd_ed68_3935_db70_4c49f3b25a03 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
playground/html/vite.config.js lines 274–300
function serveExternalPathPlugin() {
const handler = (req, res, next) => {
if (req.url === '/external-path.js') {
res.setHeader('Content-Type', 'application/javascript')
res.end('document.querySelector(".external-path").textContent = "works"')
} else if (req.url === '/external-path.css') {
res.setHeader('Content-Type', 'text/css')
res.end('.external-path{color:red}')
} else if (req.url === '/external-path-by-rollup-options.js') {
res.setHeader('Content-Type', 'application/javascript')
res.end(
'document.querySelector(".external-path-by-rollup-options").textContent = "works"',
)
} else {
next()
}
}
return {
name: 'serve-external-path',
configureServer(server) {
server.middlewares.use(handler)
},
configurePreviewServer(server) {
server.middlewares.use(handler)
},
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does serveExternalPathPlugin() do?
serveExternalPathPlugin() is a function in the vite codebase, defined in playground/html/vite.config.js.
Where is serveExternalPathPlugin() defined?
serveExternalPathPlugin() is defined in playground/html/vite.config.js at line 274.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free