fix(start-plugin-core): use plugin load hook for bundled dev in start-compiler-plugin #8681
Openlx3133584(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/8681/headopened - packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts line 75@@ -67,17 +67,9 @@676768-async function loadViteModuleFromEnvironment(68+export async function loadViteModuleFromEnvironment(6969 environment: Environment,7070 id: string,7171 opts: ViteModuleLoadOptions,7272 ): Promise<string | undefined> {73- if (74- environment.mode === 'build' ||75- (environment.mode === 'dev' &&76- environment.config.experimental.bundledDev &&77- environment.name === VITE_ENVIRONMENT_NAMES.client)78- ) {79- // Bundled dev must load through its current driver; transformRequest starts80- // a separate client container and can reset the compiler mid-transform.81- const loaded = await opts.load({82- id: environment.mode === 'dev' ? (opts.devId ?? id) : id,83- })73+ const isBundled =74+ Boolean((environment as any).config?.isBundled) ||75+ Boolean(environment.config?.experimental?.bundledDev)
lx3133584(GitHub profile, opens in a new tab) linked this to fix #8407
Sign in to join this conversation.
📝 Walkthrough
Walkthrough#
The change exports
loadViteModuleFromEnvironment. It uses the pluginloadhook for build and bundled environments, and keepstransformRequestfor unbundled dev environments. Tests cover these paths.Changes#
Environment module loading
packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts,packages/start-plugin-core/tests/vite/start-compiler-utils.test.tsloadhook for build mode and environments configured withisBundledorexperimental.bundledDev. Other dev environments usetransformRequest. Tests cover the load paths and the unbundled dev path.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
schiller-manuelMerge Risk: 🟡 Moderate · up to
ea6c0With bundled dev enabled, the server environment may still be unbundled. Sending it through the bundled loading path could break inspection of server-function dependencies in that mode. Confirm the per-environment bundling setting is respected before merging.
Pre-merge checks |
3 | 
2
❌ Failed checks (2 warnings)#
✅ Passed checks (3 passed)
#8407requires bundled dev to load compiler dependencies through the pluginloadhook. The change usesopts.load({ id })whenenvironment.config.isBundledor `environment.config.experiment…#8407. The exported helper enables direct unit testing, and the added tests verify the required loading paths. No unrelated source behavior or unrelated files are changed…Full details: Description check
Explanation
The description explains the problem, implementation, linked issue, and testing. However, it does not follow the repository template because it omits the required Changes, Checklist, and Release Impact sections.
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share