expo export: "Chunk containing module not found" for react-native-css components (dual import/require .cjs variants)
維護者通常 3 天內回覆
@danstepanov 已經在處理了。
開始於 2026年7月15日。
評估
這個 Issue 還沒有評估資料。
描述
Summary
npx expo export (production bundling) fails in Expo's async-chunk serializer with:
AssertionError [ERR_ASSERTION]: Chunk containing module not found:
node_modules/react-native-css/dist/commonjs/components/index.cjs
at .../@expo/metro-config/build/serializer/serializeChunks.js:211:42
at Chunk.getComputedPathsForAsyncDependencies (.../serializeChunks.js:207:19)
at Chunk.serializeToCode (.../serializeChunks.js:266:44)
at Chunk.serializeToAssetsAsync (.../serializeChunks.js:290:29)
...
at exportAppAsync (.../@expo/cli/build/src/export/exportApp.js:193:13)
The Metro dev server (expo start) bundles fine. Only expo export (and therefore production / EAS builds) fails.
Repro
It reproduces with a minimal config, so it is not caused by a custom resolver/transformer:
// metro.config.js
const { getDefaultConfig } = require("expo/metro-config");
const { withNativewind } = require("nativewind/metro");
module.exports = withNativewind(getDefaultConfig(__dirname));
npx expo export --platform android
Full repo (it also covers a separate nativewind issue, but the export failure repros directly):
https://github.com/danstepanov/nw-1824-repro → cd apps/mobile && npx expo export -p android
Likely cause
The ./components subpath exports map points the import and require conditions at two different files that share the same basename:
"./components": {
"source": "./src/components/index.cts",
"import": { "default": "./dist/module/components/index.cjs", ... },
"require": { "default": "./dist/commonjs/components/index.cjs", ... }
}
So the same logical module resolves to two distinct absolute paths depending on the active condition (dist/module/components/index.cjs vs dist/commonjs/components/index.cjs). Expo's getComputedPathsForAsyncDependencies looks up the chunk for the commonjs variant but the chunk was built around the module variant, so the assertion fires. (components/index.cjs itself is a set of lazy require() getters; the only importer in the graph is nativewind/dist/.../test-utils.)
A couple of things worth checking:
- why the ESM (
import) condition points to a.cjsfile underdist/module/, and whether collapsing both conditions to a single canonical path resolves the chunk lookup; - whether
test-utilsshould be reachable from a production graph at all.
Environment
- expo
56.0.12, react-native0.85.3, react19.2.3 - nativewind
5.0.0-preview.4, react-native-css3.0.7(latest stable) - @expo/metro-config
56.0.14 - pnpm
10.8.1monorepo,nodeLinker: hoisted(also note: minimal config, so not resolver-specific)
- 主要語言
- TypeScript
- 星號
- 166
- 分支
- 45
- 平均合併
- 13 天 14 小時
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nativewind/react-native-css 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#545 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#544 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#543 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
nativewind/react-native-css#540 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#538 ·
維護者通常 3 天內回覆
查看 nativewind/react-native-css 的全部 Issue
相似的 Issue
-
Replace discontinued crypto-js in the theme可能已有人在做 @aelmanaa 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
solana-foundation/solana-web3.js#4015 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
documentation
難度 1/5 1-3 小時 新手友好度 90/100
ivopogace/opencode-courier#422 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
chapel-lang/chapel-vscode#158 ·
維護者通常 1 天內回覆