Set module's filename to path of html.
The relative require relies on module.filename to work as expected.
This commit is contained in:
parent
fe8a2b9ee0
commit
fe4841a1cd
1 changed files with 3 additions and 0 deletions
|
@ -46,6 +46,9 @@ if window.location.protocol is 'file:'
|
||||||
window.location.pathname
|
window.location.pathname
|
||||||
global.__dirname = path.dirname global.__filename
|
global.__dirname = path.dirname global.__filename
|
||||||
|
|
||||||
|
# Set module's filename so relative require can work as expected.
|
||||||
|
module.filename = global.__filename
|
||||||
|
|
||||||
# Also search for module under the html file.
|
# Also search for module under the html file.
|
||||||
module.paths = module.paths.concat Module._nodeModulePaths(global.__dirname)
|
module.paths = module.paths.concat Module._nodeModulePaths(global.__dirname)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue