Skip to content

feat: inline vite-plugin-electron-renderer#302

Closed
Copilot wants to merge 23 commits into
mainfrom
copilot/refactor-vite-plugin-adaptations
Closed

feat: inline vite-plugin-electron-renderer#302
Copilot wants to merge 23 commits into
mainfrom
copilot/refactor-vite-plugin-adaptations

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

This pull request makes significant improvements to the built-in renderer support in the project, removing the dependency on vite-plugin-electron-renderer and 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:

  • Refactored renderer support to use the built-in plugin instead of depending on vite-plugin-electron-renderer, including updating the renderer option type and dynamic import in src/simple.ts. [1] [2] [3]
  • Removed vite-plugin-electron-renderer from package.json dependencies, peer dependencies, and pnpm-lock.yaml. [1] [2] [3] [4]
  • Added new export paths for the built-in renderer in package.json and included src/renderer.ts in the build entry points. [1] [2]

Documentation updates:

  • Updated README.md and README.zh-CN.md to 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:

  • Added new test fixtures and test cases to verify the built-in renderer plugin, including support for custom module prebundling and build callback plugins. [1] [2] [3] [4] [5] [6] [7] [8]
  • Added a dedicated compatibility regression suite that exercises the documented renderer use cases directly and verifies behavior for built-in Electron imports, resolve.type: 'cjs', resolve.type: 'esm', custom build callbacks, and the worker ipcRenderer fallback path.
  • Isolated renderer compatibility test cache output so the new regression coverage does not interfere with the existing simple API renderer tests, and updated the lockfile settings to match the current peer-install configuration for fresh installs.

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.

Copilot AI and others added 13 commits April 29, 2026 14:32
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>
@subframe7536 subframe7536 changed the title Tighten renderer prebundle hook filtering and simplify renderer module loading feat: inline vite-plugin-electron-renderer Apr 29, 2026
Copy link
Copy Markdown
Contributor

@subframe7536 subframe7536 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 1, 2026

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 ...

Added a direct renderer() compatibility regression suite in ef33784. It now covers the documented electron import path, resolve.type: 'cjs', resolve.type: 'esm', custom build callbacks, and the worker ipcRenderer fallback behavior, while isolating cache output so it can run alongside the existing simple API tests.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread package.json
Comment thread test/renderer.test.ts Outdated
Comment thread src/renderer.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use local-pkg to simplify

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI requested a review from subframe7536 May 1, 2026 02:00
@subframe7536 subframe7536 deleted the copilot/refactor-vite-plugin-adaptations branch May 9, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants