@@ -273,7 +273,8 @@ func insertCustomApp(jsPath string, flags Flag) {
273273 // React element/route patterns for path matching
274274 elementPatterns := []string {
275275 // JSX pattern (1.2.78+): (0,S.jsx)(se.qh,{path:"/collection/*",element:...})
276- `(\([\w$\.,]+\))\(([\w\.]+),\{path:"/collection(?:/[\w\*]+)?",?(element|children)?` ,
276+ // Settings page should be more consistent with having no conditional renders
277+ `(\([\w$\.,]+\))\(([\w\.]+),\{path:"/settings(?:/[\w\*]+)?",?(element|children)?` ,
277278 // createElement pattern: X.createElement(Y,{path:"/collection"...})
278279 `([\w_\$][\w_\$\d]*(?:\(\))?\.createElement|\([\w$\.,]+\))\(([\w\.]+),\{path:"\/collection"(?:,(element|children)?[:.\w,{}()$/*"]+)?\}` ,
279280 }
@@ -332,12 +333,20 @@ func insertCustomApp(jsPath string, flags Flag) {
332333 return fmt .Sprintf ("{%s%s" , appMap , submatches [1 ])
333334 })
334335
335- utils .ReplaceOnce (
336- & content ,
336+ // Seek to the full matched React.lazy pattern
337+ matchedReactPattern = utils .SeekToCloseParen (
338+ content ,
337339 matchedReactPattern ,
338- func (submatches ... string ) string {
339- return fmt .Sprintf ("%s%s" , submatches [0 ], appReactMap )
340- })
340+ '(' ,
341+ ')' ,
342+ )
343+
344+ content = strings .Replace (
345+ content ,
346+ matchedReactPattern ,
347+ fmt .Sprintf ("%s%s" , matchedReactPattern , appReactMap ),
348+ 1 ,
349+ )
341350
342351 utils .ReplaceOnce (
343352 & content ,
0 commit comments