Next.js does not pick the correct export of dependency #70296
Labels
bug
Issue was opened via the bug report template.
locked
Module Resolution
Module resolution (CJS / ESM, module resolving).
Link to the code that reproduces this issue
https://github.com/fs-eire/nextjs-onnxruntime
To Reproduce
npm ci
andnpm run dev
Current vs. Expected behavior
Current:
Expected: should be no error.
Provide environment information
Which area(s) are affected? (Select all that apply)
Module Resolution
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
This example project uses a library "onnxruntime-web", which only runs on browser. In the field "exports" in its package.json, "node" is explicitly disabled to avoid misusage of running in Node.js.
// (partial) file content of ./node_modules/onnxruntime-web/package.json
It should be working well in a browser environment for
import * as onnx from 'onnxruntime-web/webgpu';
. However it tries to read the "node" export field and fails, even if I put'use client';
in the top of the file.Related issue: microsoft/onnxruntime#21811
The text was updated successfully, but these errors were encountered: