Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/src/node/__tests__/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ describe('resolveConfig', () => {
const logger = createLogger('info')
logger.warn = (str) => {
expect(str).to.include(
'Consider renaming the directory / file to remove the characters',
'Consider renaming the directory without the characters',
)
}

Expand Down
12 changes: 9 additions & 3 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ export type ResolveFn = (
*/
function checkBadCharactersInPath(
name: string,
type: 'directory' | 'file',
path: string,
logger: Logger,
): void {
Expand All @@ -1039,7 +1040,7 @@ function checkBadCharactersInPath(
colors.yellow(
`${name} contains the ${charString} ${inflectedChars} (${colors.cyan(
path,
)}), which may not work when running Vite. Consider renaming the directory / file to remove the characters.`,
)}), which may not work when running Vite. Consider renaming the ${type} without the characters.`,
Comment thread
bluwy marked this conversation as resolved.
),
)
}
Expand Down Expand Up @@ -1487,7 +1488,12 @@ export async function resolveConfig(
config.root ? path.resolve(config.root) : process.cwd(),
)

checkBadCharactersInPath('The project root', resolvedRoot, logger)
checkBadCharactersInPath(
'The project root',
'directory',
resolvedRoot,
logger,
)

const configEnvironmentsClient = config.environments!.client!
configEnvironmentsClient.dev ??= {}
Expand Down Expand Up @@ -2283,7 +2289,7 @@ export async function loadConfigFromFile(
}
} catch (e) {
const logger = createLogger(logLevel, { customLogger })
checkBadCharactersInPath('The config path', resolvedPath, logger)
checkBadCharactersInPath('The config path', 'file', resolvedPath, logger)
logger.error(colors.red(`failed to load config from ${resolvedPath}`), {
error: e,
})
Expand Down
Loading