Skip to content

Commit f944540

Browse files
committed
publish 1.2.10
1 parent 4b92992 commit f944540

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@idrinth/react-file-based-routes",
3-
"version": "1.2.9",
3+
"version": "1.2.10",
44
"repository": "https://github.com/idrinth/react-file-based-routes",
55
"description": "A simple file based routing library, that does not force itself on you.",
66
"license": "MIT",

src/generate-folders.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export default (cwd: string, configuration: Configuration) => {
2020
}
2121
return data;
2222
})();
23-
const matcher = new RegExp(`="${cwd}/${configuration.fileFinder.pagesRoot}/([^"]*?)${configuration.fileFinder.fileName}"`, 'u');
23+
const matcher = cwd.includes('\\')
24+
? new RegExp(`="${cwd}\\\\${configuration.fileFinder.pagesRoot.replace(/\//, '\\')}\\\\([^"]*?)${configuration.fileFinder.fileName}"`, 'u')
25+
: new RegExp(`="${cwd}/${configuration.fileFinder.pagesRoot}/([^"]*?)${configuration.fileFinder.fileName}"`, 'u');
2426
const fileName = configuration.fileFinder.fileName.replace(/\.tsx$/, '-');
2527
const cssFiles = [];
2628
const jsFiles = [];
@@ -113,7 +115,7 @@ export default (cwd: string, configuration: Configuration) => {
113115
const content = readFileSync(cwd + '/' + configuration.fileFinder.distJSRoot + '/' + file, 'utf8',);
114116
const res = matcher.exec(content);
115117
if (res && res[1]) {
116-
const pageName = res[1].replace(/\/$/u, '');
118+
const pageName = res[1].replace(/[\\/]$/u, '');
117119
if (typeof configuration.routes.overridePathMappings[pageName] === 'string') {
118120
if (configuration.routes.overridePathMappings[pageName] !== '*') {
119121
writeIndexHtml(cwd, file, configuration.routes.overridePathMappings[pageName], template, configuration, preload);

0 commit comments

Comments
 (0)