expo export: "Chunk containing module not found" for react-native-css components (dual import/require .cjs variants)
I maintainer di solito rispondono entro 5 giorni
@danstepanov ci sta già lavorando.
Dal 15/7/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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)
- Lingua principale
- TypeScript
- Stelle
- 166
- Fork
- 45
- Merge medio
- 10g 1h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nativewind/react-native-css
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
nativewind/react-native-css#554 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nativewind/react-native-css#549 · 2 commenti ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nativewind/react-native-css#548 · 2 commenti ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nativewind/react-native-css#545 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nativewind/react-native-css#544 ·
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di nativewind/react-native-css
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Broken links in the docsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
🔊 a11y
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
betagouv/mon-entreprise#4726 ·
I maintainer di solito rispondono entro 9 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Deltares/fews-pi-requests#357 ·
I maintainer di solito rispondono entro 1 giorno
-
bug confirmed js v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno