From: Cheng Zhao Date: Tue, 7 Jan 2014 06:30:18 +0000 (+0800) Subject: Set module's filename to path of html. X-Git-Tag: v0.8.2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=fe4841a1cd59c3ada3bad53a84ad128d00428fd4;p=electron.git Set module's filename to path of html. The relative require relies on module.filename to work as expected. --- diff --git a/renderer/lib/init.coffee b/renderer/lib/init.coffee index 30e1de4e..824dbd2c 100644 --- a/renderer/lib/init.coffee +++ b/renderer/lib/init.coffee @@ -46,6 +46,9 @@ if window.location.protocol is 'file:' window.location.pathname 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. module.paths = module.paths.concat Module._nodeModulePaths(global.__dirname) else