diff --git a/.changeset/fix-query-client-rn.md b/.changeset/fix-query-client-rn.md new file mode 100644 index 00000000000..b6c01d72ab2 --- /dev/null +++ b/.changeset/fix-query-client-rn.md @@ -0,0 +1,5 @@ +--- +"@clerk/clerk-js": patch +--- + +Fix `useOrganizationList` and other query-based hooks returning empty data on React Native by using `dynamicImportMode: 'eager'` in the native rspack build so dynamic imports resolve synchronously diff --git a/packages/clerk-js/bundlewatch.config.json b/packages/clerk-js/bundlewatch.config.json index 45853fa48ba..2b6b08948a0 100644 --- a/packages/clerk-js/bundlewatch.config.json +++ b/packages/clerk-js/bundlewatch.config.json @@ -4,7 +4,7 @@ { "path": "./dist/clerk.browser.js", "maxSize": "67KB" }, { "path": "./dist/clerk.legacy.browser.js", "maxSize": "108KB" }, { "path": "./dist/clerk.no-rhc.js", "maxSize": "307KB" }, - { "path": "./dist/clerk.native.js", "maxSize": "66KB" }, + { "path": "./dist/clerk.native.js", "maxSize": "545KB" }, { "path": "./dist/vendors*.js", "maxSize": "7KB" }, { "path": "./dist/coinbase*.js", "maxSize": "36KB" }, { "path": "./dist/base-account-sdk*.js", "maxSize": "203KB" }, diff --git a/packages/clerk-js/rspack.config.js b/packages/clerk-js/rspack.config.js index af1e2548990..43f0e0e733f 100644 --- a/packages/clerk-js/rspack.config.js +++ b/packages/clerk-js/rspack.config.js @@ -284,10 +284,20 @@ const prodConfig = ({ mode, env, analysis }) => { commonForProdChunked(), // Disable chunking for the native variant, since it's meant to be used in React Native // where dynamic chunk loading is not supported. + // `dynamicImportMode: 'eager'` inlines all dynamic import() modules directly into the + // bundle and resolves the returned Promise immediately, so rspack's async chunk-loading + // runtime (which doesn't work in Metro) is never emitted. { output: { publicPath: '', }, + module: { + parser: { + javascript: { + dynamicImportMode: 'eager', + }, + }, + }, optimization: { splitChunks: false, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0a5b24875d4..5d62235d895 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2607,7 +2607,7 @@ packages: '@expo/bunyan@4.0.1': resolution: {integrity: sha512-+Lla7nYSiHZirgK+U/uYzsLv/X+HaJienbD5AKX1UQZHYfWaP+9uuQluRB4GrEVWF0GZ7vEVp/jzaOT9k/SQlg==} - engines: {node: '>=0.10.0'} + engines: {'0': node >=0.10.0} '@expo/cli@0.22.26': resolution: {integrity: sha512-I689wc8Fn/AX7aUGiwrh3HnssiORMJtR2fpksX+JIe8Cj/EDleblYMSwRPd0025wrwOV9UN1KM/RuEt/QjCS3Q==}