diff --git a/lib/prepare.js b/lib/prepare.js index ce8371b9cd..f25c777c6f 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -236,14 +236,14 @@ async function genComponentRegistrationFile ({ sourceDir }) { return `import Vue from 'vue'\n` + components.map(genImport).join('\n') } -const indexRE = /(?<=(^|\/))(index|readme)\.md$/i +const indexRE = /(^|.*\/)(index|readme)\.md$/i const extRE = /\.(vue|md)$/ function fileToPath (file) { if (isIndexFile(file)) { // README.md -> / // foo/README.md -> /foo/ - return '/' + file.replace(indexRE, '') + return file.replace(indexRE, '/$1') } else { // foo.md -> /foo.html // foo/bar.md -> /foo/bar.html