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
Calling this.getModuleInfo inside load returns no information. My scenario is forwarding custom module meta data from the resolveId hook and then trying to access it within the load hook. Reading through the Rollup plugin API docs I would expect the following code to work.
consttestPlugin={name: 'module-info',resolveId(id){if(id==='virtual-file'){return{ id,meta: {moduleInfo: {canYouSeeMe: true}}};}},load(id){if(id==='virtual-file'){const{ meta }=this.getModuleInfo(id);if(meta.moduleInfo.canYouSeeMe){// do stuff}}},};
import{defineConfig}from"vite";exportdefaultdefineConfig({plugins: [{name: 'module-info',resolveId(id){if(id==='virtual-file'){console.log("meta0",(this.getModuleInfo(id)));return{ id,meta: {moduleInfo: {canYouSeeMe: true}}}}},load(id){if(id==='virtual-file'){console.log("meta1",(this.getModuleInfo(id)));// load code is needed to see meta data addedreturn{code: ''}}}}]})
Describe the bug
Calling
this.getModuleInfo
insideload
returns no information. My scenario is forwarding custom module meta data from theresolveId
hook and then trying to access it within theload
hook. Reading through the Rollup plugin API docs I would expect the following code to work.Reproduction
https://github.com/mattcompiles/vite-moduleinfo-issue/blob/main/vite.config.js
System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager: yarn
The text was updated successfully, but these errors were encountered: