@@ -15,16 +15,18 @@ module.exports = function htmlTagJsxLoader(source) {
1515
1616 try {
1717 // Debug logging - verify loader is running
18- // console.log(`🔧 Custom JSX loader processing: ${this.resourcePath}\n`);
18+ console . log ( `🔧 Custom JSX loader processing: ${ this . resourcePath } \n` ) ;
1919
2020 // Determine file type from extension
2121 const isTypeScript = / \. t s x ? $ / . test ( this . resourcePath ) ;
2222
2323 // Quick check: if no JSX syntax at all, pass through unchanged
2424 // Look for complete JSX opening tags with proper spacing
25- const hasJSXLike = / < [ A - Z ] [ a - z A - Z 0 - 9 ] * (?: \s | \/ ? > ) | < [ a - z ] + (?: \s | \/ ? > ) / . test ( source ) ;
25+ const hasJSXLike =
26+ / < \/ ? [ A - Z ] [ a - z A - Z 0 - 9 ] * [ ^ > ] * > | < \/ ? [ a - z ] [ a - z 0 - 9 - ] * [ ^ > ] * > / . test ( source ) ;
27+ console . log ( `loader :: ${ this . resourcePath } ` , { hasJSXLike } ) ;
2628 if ( ! hasJSXLike ) {
27- return callback ( null , source )
29+ return callback ( null , source ) ;
2830 }
2931
3032 // Parse with appropriate plugins
@@ -42,8 +44,12 @@ module.exports = function htmlTagJsxLoader(source) {
4244 let needsTagImport = false ;
4345 let hasJSX = false ;
4446 const hasExistingImport =
45- / i m p o r t \s + (?: \{ [ ^ } ] * \b t a g \b [ ^ } ] * \} | t a g (?: \s + a s \s + \w + ) ? ) \s + f r o m \s + [ ' " ] h t m l - t a g - j s [ ' " ] / . test ( source ) ||
46- / (?: c o n s t | l e t | v a r ) \s + (?: \{ [ ^ } ] * \b t a g \b [ ^ } ] * \} | t a g ) \s * = \s * r e q u i r e \s * \( \s * [ ' " ] h t m l - t a g - j s [ ' " ] \s * \) / . test ( source ) ;
47+ / i m p o r t \s + (?: \{ [ ^ } ] * \b t a g \b [ ^ } ] * \} | t a g (?: \s + a s \s + \w + ) ? ) \s + f r o m \s + [ ' " ] h t m l - t a g - j s [ ' " ] / . test (
48+ source ,
49+ ) ||
50+ / (?: c o n s t | l e t | v a r ) \s + (?: \{ [ ^ } ] * \b t a g \b [ ^ } ] * \} | t a g ) \s * = \s * r e q u i r e \s * \( \s * [ ' " ] h t m l - t a g - j s [ ' " ] \s * \) / . test (
51+ source ,
52+ ) ;
4753
4854 // Transform JSX elements
4955 traverse ( ast , {
0 commit comments