Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

expo export: "Chunk containing module not found" for react-native-css components (dual import/require .cjs variants)

Offen
#364 2 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@danstepanov arbeitet bereits daran.

Seit 15.7.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

auto-triaged needs-deep-triage v5 stability
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 .cjs file under dist/module/, and whether collapsing both conditions to a single canonical path resolves the chunk lookup;
  • whether test-utils should be reachable from a production graph at all.
Environment
  • expo 56.0.12, react-native 0.85.3, react 19.2.3
  • nativewind 5.0.0-preview.4, react-native-css 3.0.7 (latest stable)
  • @expo/metro-config 56.0.14
  • pnpm 10.8.1 monorepo, nodeLinker: hoisted (also note: minimal config, so not resolver-specific)
Vorherrschende Sprache
TypeScript
Sterne
166
Forks
45
Ø Merge
13 T. 14 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nativewind/react-native-css

Alle Issues in nativewind/react-native-css

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.