fix(vite): cross-package bare imports also fail for workspace-member modules (#156) - #157
Merged
Conversation
…ross-package bare imports from module pages (#152)
…esbuildOptions.nodePaths for Vite 8 (#152)
…ite 6 vs 8 paths (#152)
…modules (#156) The moduleBareImportResolver plugin added in #154 short-circuits when the importer path sits under fsRoot/projectRoot, which was meant to skip host-internal files but ends up skipping workspace-member module pages too. In an npm-workspaces scaffold (`workspaces: ["host/client_app", "modules/*"]`) deps hoist to the workspace root, so fsRoot resolves to the workspace root — and workspace-member modules at `modules/<name>/...` sit *under* it. The early-return excluded the very modules that need workspace-root re-resolution, so bare imports like `maplibre-gl` / `pmtiles` failed with "could not be resolved" during dev resolveId. Drop the fsRoot/projectRoot containment check; the `modulePagesPrefixes` guard already pins the plugin to module-page importers regardless of whether they live inside or outside the workspace tree. Apply the fix to both the scaffold template (Vite 6) and the framework's host config (Vite 8). Add a content-level regression test ensuring the bad early- return doesn't reappear.
Deploying simple-module-python with
|
| Latest commit: |
ce0322e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://352b6095.simple-module-python.pages.dev |
| Branch Preview URL: | https://githubissues.simple-module-python.pages.dev |
# Conflicts: # CHANGELOG.md # framework/cli/tests/test_scaffolding_host.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #156. The
moduleBareImportResolverVite plugin added in #154 short-circuits when the importer path sits underfsRoot/projectRoot, which was meant to skip host-internal files but ends up skipping workspace-member module pages too.In an npm-workspaces scaffold (
workspaces: ["host/client_app", "modules/*"]) deps hoist to the workspace root, sofsRootresolves to the workspace root — and workspace-member modules atmodules/<name>/<pkg>/pages/sit under it. The early-return excluded the very modules that need workspace-root re-resolution, so bare imports likemaplibre-gl/pmtilesfailed with "could not be resolved" during devresolveId.The fix drops the
fsRoot/projectRootcontainment check; themodulePagesPrefixesguard already pins the plugin to module-page importers regardless of whether they live inside or outside the workspace tree. Applied to both the scaffold template (Vite 6) and the framework's host config (Vite 8).The dep-scanner path is already covered by the workspace-
node_modulesNODE_PATH-style fallback seeded viaoptimizeDeps.esbuildOptions.nodePaths(scaffold template) /optimizeDeps.rolldownOptions.resolve.modules(host) from #152.Test plan
startsWith(fsRootPrefix)early-return doesn't reappear (test_scaffold_vite_resolver_does_not_skip_workspace_modules).uv run pytest framework/cli/tests/ framework/hosting/tests/— 217 passed.make lintclean (preexisting biome warning unrelated to this change).