Open DimitarChristoff opened 11 years ago
I would also vote for that. We work in multiple environments (osx, windows) and such path normalization during r.js build would be nice.
The main, include, exclude, excludeShallow, and insertRequire options expect module IDs, which should all be front slashed strings, not back-slashed ones. In this case, using path.join is not necessary.
I need to do a better job though of enforcing that, as I can see where it is not obvious. Putting this in the 2.2.0 bucket.
yes, path.join
is not needed here but this is written to illustrate a point. the context is a cli builder that works with files to find what and how to build and it passes the end result to require optimizer. I am currently working around this by replacing \ with / beforehand anyway, just thought it was never going to be useful to leave \ in the module names.
Using r.js for a custom builder of components on osx and win32 machines. for various reasons, path management in the builder is done via path.join / resolve / relative etc, which is taking into account path.sep (/ or ).
Example passed to config for r.js:
on osx this results in
../src/components/widget/main' and the resulting module gets a normalized
name` of (relative to the correct baseUrl):on windows, we get the
..\\src\\components\\widget\\main
passed to r.js and the module name becomes:... which simply does not match any require statements in the code after. since it's for web building (URI), shouldn't there be a way to normalize the names for that?