You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes a Vite SSR warning on macOS by replacing a manually constructed file:// URL template literal with the proper pathToFileURL utility from Node's built-in node:url module when dynamically importing the project's prettier config file.
Adds import { pathToFileURL } from 'node:url' to packages/cli-helpers/src/lib/index.ts
Replaces `file://${prettierConfigPath}` with pathToFileURL(prettierConfigPath).href in getPrettierOptions
pathToFileURL is the idiomatic, correct way to convert a file-system path to a file: URL — it handles special characters, platform differences (Windows drive letters), and produces a properly encoded URL that satisfies Node.js and Vite's URL host validation on darwin
Confidence Score: 5/5
This PR is safe to merge — it's a targeted, idiomatic one-liner fix with no risk of regression.
The change is minimal (one import + one expression replacement), uses the standard Node.js utility for the job, is cross-platform correct, and directly addresses the reported Vite warning. No logic is altered beyond URL construction.
No files require special attention.
Important Files Changed
Filename
Overview
packages/cli-helpers/src/lib/index.ts
Replaces manual file:// template literal with pathToFileURL from node:url to properly construct file URLs on macOS (darwin), fixing a Vite SSR warning.
Sequence Diagram
sequenceDiagram
participant C as CLI / Vite SSR
participant G as getPrettierOptions()
participant FS as node:fs
participant URL as node:url (pathToFileURL)
participant I as dynamic import()
C->>G: call getPrettierOptions()
G->>FS: existsSync(cjsPath)
FS-->>G: true/false → prettierConfigPath
G->>URL: pathToFileURL(prettierConfigPath).href
URL-->>G: properly encoded file:/// URL
G->>I: import(fileURL)
I-->>G: { default: options }
G-->>C: options
Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci
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
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.
This PR fixes this warning: