From dd4d0476a5136cbfea985abab910f386c13e0fc7 Mon Sep 17 00:00:00 2001 From: developomp Date: Sat, 15 May 2021 12:36:40 +0900 Subject: [PATCH] fixed replaceAll() does not exist error --- source/generate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/generate.ts b/source/generate.ts index 80d71c5..8407be2 100644 --- a/source/generate.ts +++ b/source/generate.ts @@ -25,9 +25,11 @@ function addFiles(filesPath: string) { // not perfect. Some filenames might cause problem. let stats = fs.lstatSync(filesPath) // checks if the path leads to a directory or a file + + // don't use replaceAll let urlPath = `/${path.relative(dirPath, filesPath)}` // path tha will be used for url .replace(/\.[^/.]+$/, "") // remove .md file extension - .replaceAll(" ", "-") // replace space with a dash "-" + .replace(/ /g, "-") // replace space with a dash "-" // if it's a directory, apply this function to every files/folders in it // if it's a file, read and add it to pageList