Skip to content

Commit 3082dca

Browse files
committed
Merge branch 'feature/commonjs-support' of https://github.com/saschagehlich/three.js into dev
2 parents 53c47e6 + 7b4d0af commit 3082dca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/build/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def main(argv=None):
4646
sources = []
4747

4848
if args.amd:
49-
tmp.write('( function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( factory );\n\n\t} else {\n\n\t\troot.THREE = factory();\n\n\t}\n\n}( this, function () {\n\n')
49+
tmp.write('( function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( [\'exports\'], factory );\n\n\t} else if (typeof exports === \'object\') {\n\n\t\tfactory(exports);\n\n\t} else {\n\n\t\tfactory(root);\n\n\t}\n\n}( this, function (exports) {\n\n')
5050

5151
for include in args.include:
5252
with open('includes/' + include + '.json','r') as f:
@@ -59,7 +59,7 @@ def main(argv=None):
5959
tmp.write('\n')
6060

6161
if args.amd:
62-
tmp.write('return THREE;\n\n} ) );')
62+
tmp.write('exports.THREE = THREE;\n\n} ) );')
6363

6464
tmp.close()
6565

0 commit comments

Comments
 (0)