projects
/
platform
/
framework
/
web
/
crosswalk-tizen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fe8a2b9
)
Set module's filename to path of html.
author
Cheng Zhao
<zcbenz@gmail.com>
Tue, 7 Jan 2014 06:30:18 +0000
(14:30 +0800)
committer
Cheng Zhao
<zcbenz@gmail.com>
Tue, 7 Jan 2014 06:30:18 +0000
(14:30 +0800)
The relative require relies on module.filename to work as expected.
renderer/lib/init.coffee
patch
|
blob
|
history
diff --git
a/renderer/lib/init.coffee
b/renderer/lib/init.coffee
index
30e1de4
..
824dbd2
100644
(file)
--- 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