Skip to content

Commit

Permalink
fix: missing swc config in RN & NM rules (#843)
Browse files Browse the repository at this point in the history
* fix: missing swc config in RN & NM rules

* chore: update templates

* chore: apply the change in related configs

* chore: changeset

* chore: undo bugfixes change
  • Loading branch information
jbroma authored Dec 30, 2024
1 parent d8eb77e commit 3029ab6
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-wasps-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@callstack/repack": patch
---

Fix missing config for swc loader rules
1 change: 1 addition & 0 deletions apps/tester-app/rspack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default (env) => {
/** @type {import('@rspack/core').SwcLoaderOptions} */
options: {
env: {
loose: true,
targets: {
'react-native': '0.74',
},
Expand Down
6 changes: 5 additions & 1 deletion apps/tester-federation-v2/rspack.config.host-app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default (env) => {
use: {
loader: 'builtin:swc-loader',
options: {
env: { targets: { 'react-native': '0.74' } },
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: { externalHelpers: true },
},
},
Expand All @@ -74,6 +77,7 @@ export default (env) => {
options: {
sourceMaps: true,
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: {
Expand Down
6 changes: 5 additions & 1 deletion apps/tester-federation-v2/rspack.config.mini-app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export default (env) => {
use: {
loader: 'builtin:swc-loader',
options: {
env: { targets: { 'react-native': '0.74' } },
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: { externalHelpers: true },
},
},
Expand All @@ -73,6 +76,7 @@ export default (env) => {
options: {
sourceMaps: true,
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: {
Expand Down
6 changes: 5 additions & 1 deletion apps/tester-federation/rspack.config.host-app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export default (env) => {
use: {
loader: 'builtin:swc-loader',
options: {
env: { targets: { 'react-native': '0.74' } },
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: { externalHelpers: true },
},
},
Expand All @@ -80,6 +83,7 @@ export default (env) => {
options: {
sourceMaps: true,
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: {
Expand Down
6 changes: 5 additions & 1 deletion apps/tester-federation/rspack.config.mini-app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export default (env) => {
use: {
loader: 'builtin:swc-loader',
options: {
env: { targets: { 'react-native': '0.74' } },
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: { externalHelpers: true },
},
},
Expand All @@ -79,6 +82,7 @@ export default (env) => {
options: {
sourceMaps: true,
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: {
Expand Down
2 changes: 2 additions & 0 deletions packages/repack/src/rules/nodeModulesLoadingRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const makeSwcLoaderConfig = (syntax: 'js' | 'ts', jsx: boolean) => ({
loader: 'builtin:swc-loader',
options: {
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: {
Expand All @@ -24,6 +25,7 @@ const makeSwcLoaderConfig = (syntax: 'js' | 'ts', jsx: boolean) => ({
type: 'commonjs',
strict: false,
strictMode: false,
noInterop: false,
},
},
});
Expand Down
2 changes: 2 additions & 0 deletions packages/repack/src/rules/reactNativeLoadingRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const REACT_NATIVE_LOADING_RULES: RuleSetRule = {
loader: 'builtin:swc-loader',
options: {
env: {
loose: true,
targets: { 'react-native': '0.74' },
},
jsc: {
Expand All @@ -47,6 +48,7 @@ export const REACT_NATIVE_LOADING_RULES: RuleSetRule = {
strict: false,
strictMode: false,
lazy: REACT_NATIVE_LAZY_IMPORTS,
noInterop: false,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions templates_v5/rspack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module.exports = (env) => {
loader: 'builtin:swc-loader',
options: {
env: {
loose: true,
targets: {
'react-native': '0.74',
},
Expand Down
1 change: 1 addition & 0 deletions templates_v5/rspack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default (env) => {
/** @type {import('@rspack/core').SwcLoaderOptions} */
options: {
env: {
loose: true,
targets: {
'react-native': '0.74',
},
Expand Down

0 comments on commit 3029ab6

Please sign in to comment.