-
Notifications
You must be signed in to change notification settings - Fork 7.3k
On Windows in Node 0.11.13 path.resolve causes files to be re-evaluated on second require #7806
Comments
Thanks for reporting, but I couldn't accept this as a test case. Could you please reduce it to a chunk of javascript code that doesn't have any external dependencies? |
I managed to set up a Windows VM with Node 0.11.13 and reproduce the issue there. What happens is the |
I have a test case. It consists of 3 files, all in the same directory. In Windows on Git Bash or on OS X if you invoke:
you'll get:
whereas on Windows
Files:
var path = require('path');
require('./file2.js');
require(path.resolve('./file1.js'));
//require('./file1.js');
console.log('file1 required');
require('./file2.js');
console.log('file2 required'); Interestingly enough, if you uncomment the last line in |
The problem seems to boil down to |
Shouldn't this be already tested by https://github.com/joyent/node/blob/4f1782ef750fb171eb90a1d97b14e2ed3a8a165d/test/simple/test-require-resolve.js#L27-L28? |
I wanted to narrow it down further and try to fix it myself but the So I guess I'll leave you there. |
@indutny Do you need anything else from me? |
There's already a (rather old) PR to address this #6774 |
Fixed in f6e5740 |
In general path functions don't change the case of a path. Making an exception for windows drive letters violates the principle of least surprise. Changing the drive letter case has caused a lot of issues, including nodejs#7031, nodejs#7806 and lots of bikeshedding about whether uppercase is the right case or lowercase. This effectively reverts nodejs/node-v0.x-archive@a05f973 PR-URL: nodejs/node#100
In general path functions don't change the case of a path. Making an exception for windows drive letters violates the principle of least surprise. Changing the drive letter case has caused a lot of issues, including nodejs#7031, nodejs#7806 and lots of bikeshedding about whether uppercase is the right case or lowercase. This effectively reverts nodejs/node-v0.x-archive@a05f973 PR-URL: nodejs/node#100
In general path functions don't change the case of a path. Making an exception for windows drive letters violates the principle of least surprise. Changing the drive letter case has caused a lot of issues, including nodejs#7031, nodejs#7806 and lots of bikeshedding about whether uppercase is the right case or lowercase. This effectively reverts nodejs/node-v0.x-archive@a05f973 Reviewed-by: Alexis Campailla <alexis@janeasystems.com> Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
npm test
Effect: https://ci.appveyor.com/project/mzgol/grunt-check-dependencies/build/3/job/v5ik5b0f0b7nui91
This is because in this line:
https://github.com/mzgol/grunt-check-dependencies/blob/b904397b9ffc459e8a175d0026bd4063eb1f6676/test/spec.js#L37
grunt.config(['checkDependencies', 'ok', 'options'])
returnsundefined
.grunt.config()
in this place returns an empty object.It works fine on OS X (and Linux, as seen in Travis) in both Node 0.10.29 and 0.11.13 and on Windows 8.1 on Node 0.10.29.
I don't currently have a convenient Windows setup to try to narrow the issue down but it seems there's a bug in this specific configuration.
Reported originally as gruntjs/grunt#1166
The text was updated successfully, but these errors were encountered: