feat: inline vite-plugin-electron-renderer#302
Conversation
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/2d50abfa-4b08-4b1d-a693-0da7c788be4a Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/2d50abfa-4b08-4b1d-a693-0da7c788be4a Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/0509bfde-c226-4d8d-bd76-86ce7ba4613e Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/0509bfde-c226-4d8d-bd76-86ce7ba4613e Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/0509bfde-c226-4d8d-bd76-86ce7ba4613e Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/0509bfde-c226-4d8d-bd76-86ce7ba4613e Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/0509bfde-c226-4d8d-bd76-86ce7ba4613e Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/95063129-9a8b-4d80-b6ce-6e15ad3be93d Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/95063129-9a8b-4d80-b6ce-6e15ad3be93d Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/95063129-9a8b-4d80-b6ce-6e15ad3be93d Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/95063129-9a8b-4d80-b6ce-6e15ad3be93d Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/dd2b6531-51b3-4c29-8274-c3f9668867a8 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/dd2b6531-51b3-4c29-8274-c3f9668867a8 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
subframe7536
left a comment
There was a problem hiding this comment.
The current tests prove the new built-in path works, but they don’t demonstrate that it is behaviorally equivalent to the old package. Since this PR removes the external dependency and reimplements the feature in src/renderer.ts, I’d strongly recommend adding relative compatibility tests that compare old-vs-new behavior for the documented renderer use cases:
built-in electron imports
resolve.type: 'cjs' module handling
resolve.type: 'esm' prebundle handling
custom build callbacks
worker / ipcRenderer fallback behavior
Without those comparisons, it’s hard to tell whether this is truly functionally identical or if there are subtle regressions in module resolution, prebundling, or export shape.
Could we add a small regression suite that validates the new implementation against the old package’s documented examples, or otherwise prove the behavior is the same before merging?
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/735e255a-4863-4f27-b6ac-3414d75d0b76 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/735e255a-4863-4f27-b6ac-3414d75d0b76 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Added a direct |
There was a problem hiding this comment.
Pull request overview
This PR inlines the previously external vite-plugin-electron-renderer functionality into vite-plugin-electron, exposing it as a built-in renderer plugin and updating docs/tests accordingly to remove the external dependency.
Changes:
- Added a new built-in renderer plugin implementation (
src/renderer.ts) and wired it into the simple API (src/simple.ts). - Updated package/build metadata to export/build the new renderer entry and removed the external renderer dependency.
- Added/extended test fixtures and test coverage to validate renderer compatibility and prebundle behavior.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tsdown.config.ts | Adds renderer as a build entrypoint. |
| src/simple.ts | Switches renderer option to the built-in plugin and updates option typing. |
| src/renderer.ts | Introduces the inlined renderer plugin implementation (virtual modules + prebundle support). |
| package.json | Adds ./renderer export and removes vite-plugin-electron-renderer dependency/peerDependency. |
| pnpm-lock.yaml | Removes lock entries for the removed dependency. |
| README.md | Updates docs to reflect built-in renderer support and adjusts config comment to rolldownOptions. |
| README.zh-CN.md | Same as README.md, plus removes old dependency references. |
| test/renderer.test.ts | New compatibility-focused renderer regression suite. |
| test/plugin.test.ts | Extends tests to assert simple API builds include built-in renderer and prebundle hooks. |
| test/fixtures/renderer-build/* | New fixture for renderer import behavior. |
| test/fixtures/renderer-resolve-build/* | New fixture for custom resolve/prebundle behavior via simple API. |
| test/fixtures/renderer-compat-resolve-build/* | New fixture for renderer-only compatibility tests. |
| .npmrc | Formatting-only adjustment to the ELECTRON_MIRROR line. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/e075695b-8eaf-4d1c-b2f3-1a7a65ce620e Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
There was a problem hiding this comment.
use local-pkg to simplify
There was a problem hiding this comment.
Updated in 1b5d696. src/renderer.ts now uses local-pkg for the cache-root fallback while keeping the existing nearest-node_modules behavior intact, and the renderer/simple API test suites still pass with that lookup path.
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/fd4927ec-5ce7-46b5-8fa7-35dc84abdce6 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/fd4927ec-5ce7-46b5-8fa7-35dc84abdce6 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electron-vite/vite-plugin-electron/sessions/fd4927ec-5ce7-46b5-8fa7-35dc84abdce6 Co-authored-by: subframe7536 <78338239+subframe7536@users.noreply.github.com>
This pull request makes significant improvements to the built-in renderer support in the project, removing the dependency on
vite-plugin-electron-rendererand integrating renderer functionality directly. Documentation and tests have been updated to reflect this change, and related code has been refactored for clarity and maintainability.Renderer integration and dependency removal:
vite-plugin-electron-renderer, including updating therendereroption type and dynamic import insrc/simple.ts. [1] [2] [3]vite-plugin-electron-rendererfrompackage.jsondependencies, peer dependencies, andpnpm-lock.yaml. [1] [2] [3] [4]package.jsonand includedsrc/renderer.tsin the build entry points. [1] [2]Documentation updates:
README.mdandREADME.zh-CN.mdto clarify that the renderer option is now built-in and no extra plugin is required. Also fixed a typo in comments and removed references to the old renderer package. [1] [2] [3] [4] [5] [6]Testing improvements:
resolve.type: 'cjs',resolve.type: 'esm', custom build callbacks, and the workeripcRendererfallback path.These changes ensure that Electron renderer support is now fully integrated and easier to use, with improved documentation and comprehensive tests proving compatibility with the previously documented renderer behavior.