File tree Expand file tree Collapse file tree 4 files changed +49
-52
lines changed
packages/repack/src/rules Expand file tree Collapse file tree 4 files changed +49
-52
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @callstack/repack " : patch
3+ ---
4+
5+ Fix type JSX runtime transform when transpiling node modules
Original file line number Diff line number Diff line change 11PODS:
22 - boost (1.84.0)
3- - callstack-repack (5.0.0-rc.0 ):
3+ - callstack-repack (5.0.0-rc.2 ):
44 - DoubleConversion
55 - glog
66 - hermes-engine
@@ -1852,7 +1852,7 @@ EXTERNAL SOURCES:
18521852
18531853SPEC CHECKSUMS:
18541854 boost: 1dca942403ed9342f98334bf4c3621f011aa7946
1855- callstack-repack: 75464b0e26467fc4a7236373399bc0fc2281f495
1855+ callstack-repack: 3106db24c24f7a76a380230ff7794d225cecb760
18561856 DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
18571857 FBLazyVector: 7075bb12898bc3998fd60f4b7ca422496cc2cdf7
18581858 fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
Original file line number Diff line number Diff line change 11import type { RuleSetRule } from '@rspack/core' ;
22import { getModulePaths } from '../utils' ;
33
4+ const makeSwcLoaderConfig = ( syntax : 'js' | 'ts' , jsx : boolean ) => ( {
5+ loader : 'builtin:swc-loader' ,
6+ options : {
7+ env : {
8+ targets : { 'react-native' : '0.74' } ,
9+ } ,
10+ jsc : {
11+ externalHelpers : true ,
12+ loose : true ,
13+ parser :
14+ syntax === 'js'
15+ ? { syntax : 'ecmascript' , jsx : jsx }
16+ : { syntax : 'typescript' , tsx : jsx } ,
17+ transform : {
18+ react : {
19+ runtime : 'automatic' ,
20+ } ,
21+ } ,
22+ } ,
23+ module : {
24+ type : 'commonjs' ,
25+ strict : false ,
26+ strictMode : false ,
27+ } ,
28+ } ,
29+ } ) ;
30+
431/**
532 * @constant NODE_MODULES_LOADING_RULES
633 * @type {RuleSetRule }
@@ -19,58 +46,18 @@ export const NODE_MODULES_LOADING_RULES: RuleSetRule = {
1946 'react-native-tvos' ,
2047 '@callstack/react-native-visionos' ,
2148 ] ) ,
22- rules : [
49+ oneOf : [
2350 {
2451 test : / j s x ? $ / ,
25- use : [
26- {
27- loader : 'builtin:swc-loader' ,
28- options : {
29- env : {
30- targets : { 'react-native' : '0.74' } ,
31- } ,
32- jsc : {
33- loose : true ,
34- parser : {
35- syntax : 'ecmascript' ,
36- jsx : true ,
37- } ,
38- externalHelpers : true ,
39- } ,
40- module : {
41- type : 'commonjs' ,
42- strict : false ,
43- strictMode : false ,
44- } ,
45- } ,
46- } ,
47- ] ,
52+ use : [ makeSwcLoaderConfig ( 'js' , true ) ] ,
4853 } ,
4954 {
50- test : / t s x ? $ / ,
51- use : [
52- {
53- loader : 'builtin:swc-loader' ,
54- options : {
55- env : {
56- targets : { 'react-native' : '0.74' } ,
57- } ,
58- jsc : {
59- parser : {
60- syntax : 'typescript' ,
61- tsx : true ,
62- } ,
63- loose : true ,
64- externalHelpers : true ,
65- } ,
66- module : {
67- type : 'commonjs' ,
68- strict : false ,
69- strictMode : false ,
70- } ,
71- } ,
72- } ,
73- ] ,
55+ test : / t s $ / ,
56+ use : [ makeSwcLoaderConfig ( 'ts' , false ) ] ,
57+ } ,
58+ {
59+ test : / t s x $ / ,
60+ use : [ makeSwcLoaderConfig ( 'ts' , true ) ] ,
7461 } ,
7562 ] ,
7663} ;
Original file line number Diff line number Diff line change @@ -26,13 +26,18 @@ export const REACT_NATIVE_LOADING_RULES: RuleSetRule = {
2626 targets : { 'react-native' : '0.74' } ,
2727 } ,
2828 jsc : {
29+ externalHelpers : true ,
30+ loose : true ,
2931 parser : {
3032 syntax : 'ecmascript' ,
3133 jsx : true ,
3234 exportDefaultFrom : true ,
3335 } ,
34- loose : true ,
35- externalHelpers : true ,
36+ transform : {
37+ react : {
38+ runtime : 'automatic' ,
39+ } ,
40+ } ,
3641 } ,
3742 module : {
3843 type : 'commonjs' ,
You can’t perform that action at this time.
0 commit comments