diff --git a/lib/WebpackOptionsValidationError.js b/lib/WebpackOptionsValidationError.js index c4d0a21a502..b15ac7e017d 100644 --- a/lib/WebpackOptionsValidationError.js +++ b/lib/WebpackOptionsValidationError.js @@ -181,7 +181,12 @@ class WebpackOptionsValidationError extends Error { else return `${dataPath} ${err.message}`; } else if(err.keyword === "absolutePath") { - return `${dataPath}: ${err.message}`; + const baseMessage = `${dataPath}: ${err.message}`; + if(dataPath === "configuration.output.filename") { + return `${baseMessage}\n` + + "Please use output.path to specify absolute path and output.filename for the file name."; + } + return baseMessage; } else { // eslint-disable-line no-fallthrough return `${dataPath} ${err.message} (${JSON.stringify(err, 0, 2)}).\n${getSchemaPartText(err.parentSchema)}`; diff --git a/test/Validation.test.js b/test/Validation.test.js index 40cc13ad230..f9ea8f49f29 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -185,6 +185,7 @@ describe("Validation", () => { }, message: [ " - configuration.output.filename: A relative path is expected. However the provided value \"/bar\" is an absolute path!", + " Please use output.path to specify absolute path and output.filename for the file name." ] }, { name: "absolute path",