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'm trying to use a node library that uses threads.js to load a Worker with a relative path (new Worker('./file.js')). It works fine on Linux, but fail on Windows with Error: Cannot find module '\\H:\correct\absolute\path\to\file.js'
It seems to me the culprits are the \\ remaining from the file protocol, Windows likes to add what seems to be an arbitrary number of them :D
In my case the raw path begins with file:///H:/, patching the regex to consume additional slashes allow the worker to be loaded correctly, but this obviously won't work in other cases.
I also tried to workaround the problem by using an absolute path, but it looks like it's still treated as if it was an relative one (trying to load H:\correct\absolute\path\to\H:\correct\absolute\path\to\file.js)
As a side note, as I couldn't make sense of __non_webpack_require__ by looking at the source, this is a node application written in typescript, no webpack involved.
The text was updated successfully, but these errors were encountered:
Hi! Good question. Haven't touched a Windows machine in years tbh, but maybe someone else here has an idea? 👋
About the __non_webpack_require__… We only do something with it if this code is built using webpack (if typeof __non_webpack_require__ === "function"). It doesn't affect you if you are not using webpack, but without it webpack builds would not work 😉
Hello,
I'm trying to use a node library that uses threads.js to load a Worker with a relative path (
new Worker('./file.js')
). It works fine on Linux, but fail on Windows withError: Cannot find module '\\H:\correct\absolute\path\to\file.js'
It seems to me the culprits are the
\\
remaining from the file protocol, Windows likes to add what seems to be an arbitrary number of them :Dthreads.js/src/master/implementation.node.ts
Line 72 in 8d741aa
In my case the raw path begins with
file:///H:/
, patching the regex to consume additional slashes allow the worker to be loaded correctly, but this obviously won't work in other cases.I also tried to workaround the problem by using an absolute path, but it looks like it's still treated as if it was an relative one (trying to load
H:\correct\absolute\path\to\H:\correct\absolute\path\to\file.js
)As a side note, as I couldn't make sense of
__non_webpack_require__
by looking at the source, this is a node application written in typescript, no webpack involved.The text was updated successfully, but these errors were encountered: