From 84cebcaaaf0d8c92063eb1da1108fe72d7452762 Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Tue, 28 Feb 2017 15:20:34 +0800 Subject: [PATCH] Replace backslash in requirePath to slash It will cause error when there is a backslash in page.requirePath --- lib/isomorphic/create-routes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/isomorphic/create-routes.js b/lib/isomorphic/create-routes.js index aa6b1e8204577..3150c98bcf746 100644 --- a/lib/isomorphic/create-routes.js +++ b/lib/isomorphic/create-routes.js @@ -141,6 +141,8 @@ module.exports = (files, pagesReq) => { let handler if (staticFileTypes.indexOf(page.file.ext) !== -1) { handler = wrappers[page.file.ext] + //replace the backslash in path + page.requirePath = page.requirePath.replace(/\\/g, '/'); page.data = pagesReq(`./${page.requirePath}`) } else if (reactComponentFileTypes.indexOf(page.file.ext) !== -1) { handler = pagesReq(`./${page.requirePath}`)