You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I would like to overwrite the cachedRead function for a VSCode plugin for Vite https://github.com/SimonSiefke/vscode-vite. The idea is to not serve the files from the filesystem but directly from VSCode so that one can see the page update while typing. The prototype is already working but I basically needed to fork Vite only to modify the readFile behaviour. That makes it difficult to pull in upstream changes from Vite.
Describe the solution you'd like
A possible solution would be to put the cachedRead function into the context object:
// node/server/index.tsimport{cachedRead}from'../utils'constcontext: Context={
root,
app,
server,
watcher,
resolver,
config,read: cachedRead// put cachedRead onto the context}// serverPluginEsBuild.tsif(ctx.path===vueJsxPublicPath){awaitctx.read(ctx,vueJsxFilePath)// use ctx.read instead of cachedRead}// serverPluginServeStatic.tsconstfilePath=resolver.requestToFile(ctx.path)if(filePath!==ctx.path&&fs.existsSync(filePath)&&fs.statSync(filePath).isFile()){awaitctx.read(ctx,filePath)// use ctx.read instead of cachedRead}// serverPluginVue.tsconstimporter=ctx.pathconstimportee=cleanUrl(resolveImport(root,importer,block.src!,resolver))constfilePath=resolver.requestToFile(importee)awaitctx.read(ctx,filePath)// use ctx.read instead of cachedReadblock.content=ctx.body
And plugins will be able to overwrite the read function:
Is your feature request related to a problem? Please describe.
I would like to overwrite the cachedRead function for a VSCode plugin for Vite https://github.com/SimonSiefke/vscode-vite. The idea is to not serve the files from the filesystem but directly from VSCode so that one can see the page update while typing. The prototype is already working but I basically needed to fork Vite only to modify the readFile behaviour. That makes it difficult to pull in upstream changes from Vite.
Describe the solution you'd like
A possible solution would be to put the
cachedRead
function into thecontext
object:And plugins will be able to overwrite the read function:
Additional context
The text was updated successfully, but these errors were encountered: