Skip to content

Commit 822530b

Browse files
committed
JSM: Avoid replacing strings.
1 parent fb3aae4 commit 822530b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

utils/modularize.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ function convert( path, ignoreList ) {
4444

4545
} );
4646

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

49-
if ( p1 === className ) return `${p1}${p2}`;
49+
if ( p1 === '\'' ) return match; // Inside a string
50+
if ( p2 === className ) return `${p2}${p3}`;
5051

5152
return match;
5253

0 commit comments

Comments
 (0)