expo export: "Chunk containing module not found" for react-native-css components (dual import/require .cjs variants)
Maintainer thường phản hồi trong vòng 3 ngày
@danstepanov đang làm issue này rồi.
Từ ngày 15/7/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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)
- Ngôn ngữ chính
- TypeScript
- Star
- 166
- Fork
- 45
- Merge trung bình
- 13 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nativewind/react-native-css
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#545 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#544 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#543 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
nativewind/react-native-css#540 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#538 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của nativewind/react-native-css
Issue tương tự
-
area:cli bug P4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug from-studio
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
esengine/DeepSeek-Reasonix#14868 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
linxiv-dev/linXiv#384 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
scope:core type:security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
follow-redirects updateĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
mailgun/mailgun.js#544 ·