Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for invalid file name patterns #4556

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/renderNamePattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function renderNamePattern(
if (isPathFragment(pattern))
return error(
errFailedValidation(
`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths.`
`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.`
)
);
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
Expand Down
2 changes: 1 addition & 1 deletion test/function/samples/invalid-pattern/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
generateError: {
code: 'VALIDATION_ERROR',
message:
'Invalid pattern "../main.js" for "output.entryFileNames", patterns can be neither absolute nor relative paths.'
'Invalid pattern "../main.js" for "output.entryFileNames", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.'
}
};