You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have had the "interesting" experience instantiating a module twice using require as usual.
In almost all files in the project i had var dbioSec = require("../dbiosec.js") however in one file i mistyped and wrote var dbioSec = require("../dbioSec.js")
This results in a second initialization (console.trace in module global init results in double stacktrace and partial functionality in the application.
VSCode debugger only triggers once, however there are two -or perhaps 1,15 instance :-) since something seems shared accordingly and some module scoped vars certainly behaves interesting.
I believe that this odd behaviour compared to 6.x where the problem did not manifest itself - or that I did not hit it in the unit testing.
A "fix" could be linter / load warning, application crash or whatever - almost anything will be better than keep running :-)
The text was updated successfully, but these errors were encountered:
Additionally, on case-insensitive file systems or operating systems, different resolved filenames can point to the same file, but the cache will still treat them as different modules and will reload the file multiple times. For example, require('./foo') and require('./FOO') return two different objects, irrespective of whether or not ./foo and ./FOO are the same file.
I'm closing this out as a duplicate of #5143, #11889#14019, #14084, #16731 and quite probably others. See the discussion in those issues if you're interested why we can't / won't change that.
@bnoordhuis Is there room for a warning in node.js?
pseudo code if(isWindows && cache.hasOwnPorperty(modulename.toLower) then console.warn ("A U sure you wish to play the casing game on windows?"
There is not, I'm afraid. Case sensitivity is a property of the file system, not the operating system. Determining whether a file path is treated case-sensitive or not is a Hard Problem.
I have had the "interesting" experience instantiating a module twice using require as usual.
In almost all files in the project i had
var dbioSec = require("../dbiosec.js")
however in one file i mistyped and wrotevar dbioSec = require("../dbioSec.js")
This results in a second initialization (console.trace in module global init results in double stacktrace and partial functionality in the application.
VSCode debugger only triggers once, however there are two -or perhaps 1,15 instance :-) since something seems shared accordingly and some module scoped vars certainly behaves interesting.
I believe that this odd behaviour compared to 6.x where the problem did not manifest itself - or that I did not hit it in the unit testing.
A "fix" could be linter / load warning, application crash or whatever - almost anything will be better than keep running :-)
The text was updated successfully, but these errors were encountered: