diff --git a/lib/webpack/markdownLoader.js b/lib/webpack/markdownLoader.js index ab2c699050..1aa38f32ce 100644 --- a/lib/webpack/markdownLoader.js +++ b/lib/webpack/markdownLoader.js @@ -58,7 +58,7 @@ module.exports = function (src) { // check if relative links are valid links && links.forEach(link => { const shortname = link - .replace(/#[\w-]*$/, '') + .replace(/#.*$/, '') .replace(/\.html$/, '.md') const filename = shortname .replace(/\/$/, '/README.md') @@ -69,7 +69,7 @@ module.exports = function (src) { const dir = path.dirname(this.resourcePath) const file = path.resolve(dir, filename) const altfile = altname !== filename ? path.resolve(dir, altname) : null - if (!fs.existsSync(file) && (altfile && !fs.existsSync(altfile))) { + if (!fs.existsSync(file) && (!altfile || !fs.existsSync(altfile))) { this.emitWarning( new Error( `\nFile for relative link "${link}" does not exist.\n` +