diff --git a/.changeset/tame-mugs-fail.md b/.changeset/tame-mugs-fail.md new file mode 100644 index 00000000..62834986 --- /dev/null +++ b/.changeset/tame-mugs-fail.md @@ -0,0 +1,7 @@ +--- +'@urql/exchange-graphcache': patch +'@urql/core': patch +'@urql/next': patch +--- + +Remove the invalid `exports` field from the generated subpath `package.json` files (e.g. `@urql/exchange-graphcache/extras`, `@urql/exchange-graphcache/default-storage`, `@urql/core/internal`, `@urql/next/rsc`). These targets pointed at the parent `dist/` directory (`../dist/...`), which violates the Node.js package-exports spec requirement that every `exports` target begin with `./`. Metro (Expo 53 / React Native 0.79) validates this and logged a warning for every affected package. Subpath resolution continues to work: `exports`-aware bundlers resolve through the root `package.json`, while legacy resolution relies on the `main`/`module`/`types` fields that remain in place. diff --git a/scripts/rollup/config.mjs b/scripts/rollup/config.mjs index efd027eb..57d5c780 100644 --- a/scripts/rollup/config.mjs +++ b/scripts/rollup/config.mjs @@ -34,6 +34,14 @@ const input = settings.sources.reduce((acc, source) => { const rel = relative(source.dir, process.cwd()); plugins.push({ async writeBundle() { + // NOTE: This package.json only exists to support legacy, file-based + // resolution for the subpath (e.g. `@urql/exchange-graphcache/extras`). + // Bundlers and runtimes that understand the `exports` field resolve the + // subpath through the root package.json's `exports` map instead. We must + // not emit an `exports` field here, since its targets point at the parent + // `dist/` directory (`../dist/...`) and the spec requires every `exports` + // target to begin with `./`. Metro (Expo/React Native) validates this and + // warns otherwise. See https://github.com/urql-graphql/urql/issues/3779 const packageJson = JSON.stringify( { name: source.name, @@ -43,15 +51,6 @@ const input = settings.sources.reduce((acc, source) => { module: join(rel, source.module), types: join(rel, source.types), source: join(rel, source.source), - exports: { - '.': { - types: join(rel, source.types), - import: join(rel, source.module), - require: join(rel, source.main), - source: join(rel, source.source), - }, - './package.json': './package.json', - }, }, null, 2