marcuswestin / require

javascript module management. brings node's require statement and npm to the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

__require__[<unknown path to file>] in main module

KrawN opened this issue · comments

Running server on Windows:
Dependency search in __require__ fails because the path to the dependency being pasted as text to the modified main module file is created in a different way.
Due to path.resolve it is created with backslashes which being pasted as a source code is interpreted as escaping of a character. In fact the __require__ object's properties have their keys created somehow with normal slashes.
I managed to quick-fix it via changing:
code = code.replace(requireStmnt, '__require__["'+depPath+'"]')
to:
code = code.replace(requireStmnt, '__require__["'+depPath.replace(/\\/g, '/')+'"]')