Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix: double backslashes on riot path when doing server-side rendering #2131
IMPORTANT: for all the pull requests use the
Server-side rendering injects a require to riot path in tags. The use of path.resolve() to get the path uses single backslashes as path separator on Windows, which breaks when trying to require('c:\whatever\the\path\to\riot'). This fix doubles all backslashes in the path returned by path.resolve().
Thanks but I still don't get the problem and it seems strange this issue was raised only now after 2 years. Are you sure the problem does not occur only on your machine for any other reason? Why don't you simply use the
$ RIOT=weird\path\to\riot.js node index.js
The problem is that
The first version where it happens in is 2.3.0, it works fine up to 2.2.4. I don't know why it hasn't been noticed earlier. Maybe few people use server-side rendering, and even fewer do so on Windows? For all that matters, I've reproduced the issue on several coworkers' computers as well.
Sure, using the environment variable works OK as a workaround, but that requires additional, manual steps that could be avoided if that PR were accepted.
The following is a very simple demo of the issue. Unzip it,