PART 03
Plugin system
How Vite / Rolldown / Rollup APIs relate, enforce ordering, and @vitejs/devtools.
- 3.1Vite Plugins vs Rollup PluginsHow Vite, Rollup, and Rolldown plugin hooks overlap, where they differ, and how to decide which plugin shape to author.
- 3.2Plugin Anatomy: What's Inside a Plugin ObjectStarting from TypeScript types, this article walks through every field in a Vite plugin object — name, enforce, apply, and hooks — everything you need to understand before writing your first plugin.
- 3.3Plugin Execution Order In DepthHow does enforce pre/normal/post ordering work? Where do built-in plugins cut in line? Visualize the entire execution chain with the PluginPipeline component.
- 3.4In Practice: Virtual Module PluginsImplement a virtual module plugin from scratch using resolveId + load, understand the \0 prefix convention, add HMR support, and learn how to publish it as a reusable npm package.
- 3.5Plugin CommunicationHow can multiple plugins share state? What is `this.meta`? What are the trade-offs between Vite's closure-sharing and virtual module bridge approaches?
- 3.6Debugging Vite PluginsPlugin not working? Hook not firing? Use @vitejs/devtools, DEBUG mode, and the plugin Inspector to quickly locate the problem.