Skip to content

Commit

Permalink
Merge pull request mrdoob#15582 from gkjohnson/fix-modularize-script
Browse files Browse the repository at this point in the history
JSM: Update Modularize Script to Produce Usable Modules
  • Loading branch information
Mugen87 authored Mar 13, 2019
2 parents a65a7ce + c57b480 commit 09e1fde
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/modularize.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ function convert( path, ignoreList ) {

} );

contents = contents.replace( /THREE\.([a-zA-Z0-9]+)\./g, function ( match, p1 ) {
contents = contents.replace( /THREE\.([a-zA-Z0-9]+)(\.{0,1})/g, function ( match, p1, p2 ) {

if ( p1 === className ) return `${p1}.`;
if ( p1 === className ) return `${p1}${p2}`;

return match;

Expand Down Expand Up @@ -83,7 +83,7 @@ function convert( path, ignoreList ) {

var keys = Object.keys( dependencies ).sort().map( value => '\n\t' + value ).toString();
var imports = `import {${keys}\n} from "../../../build/three.module.js";`;
var exports = `export { ${className} }`;
var exports = `export { ${className} };\n`;

var output = contents.replace( '_IMPORTS_', imports ) + '\n' + exports;

Expand Down

0 comments on commit 09e1fde

Please sign in to comment.