Closed slavb18 closed 3 years ago
@richardsimko any ideas?
It sounds like the same issue as the comment here: https://github.com/jeffijoe/awilix/pull/211/files#r557012499
Sadly I don't have access to a Windows machine to test my hypothesis but if @WagnerSilveira or @slavb18 could that would be awesome, I think it should be fairly straightforward.
@richardsimko, what should I do test ?
In the load-modules.ts
file you need to import the url package and then replace the commented line with:
importPromises.push(dependencies.require(URL.pathToFileURL(m.path)))
If my theory is correct this should work well on both Windows and nix. The test suite will take care of testing it on nix so if you can verify that it works on Windows then you have the fix right there :)
The changes made in 9fbd195f767506474d709fc65fc21528c8733139 work for me on Windows.
Additionally, as it stands, this test will always fail on Windows since the URLs of the modules after calling pathToFileURL
will no longer match with the ones specified in the test:
I'm not sure there is a test suite running on Windows, which is probably why this problem occurred to begin with. So I guess that test not working on Windows is "fine".
Anyhow good to hear that there is a fix :)
Following code not working on windows os (node 14.15.5) Same code on linux works
Error:
Following code show no error, but does not loads any modules