-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
platform:webissues related to ONNX Runtime web; typically submitted using templateissues related to ONNX Runtime web; typically submitted using template
Description
Describe the issue
tsc prints the following when type-checking a project that depends on onnxruntime-web 1.17.0. This did not happen with 1.16.x.
app/components/App.ts:3:22 - error TS7016: Could not find a declaration file for module 'onnxruntime-web'. '[…]/node_modules/onnxruntime-web/dist/esm/ort.min.js' implicitly has an 'any' type.
There are types at '[…]/node_modules/onnxruntime-web/types.d.ts', but this result could not be resolved when respecting package.json "exports". The 'onnxruntime-web' library may need to update its package.json or typings.
3 import * as ort from 'onnxruntime-web'
To reproduce
npx [email protected] --no-eslint --no-tailwind --ts --app --no-src-dir --import-alias '@/*' test
cd test
npm i onnxruntime-web
mkdir app/components
cat > app/components/App.ts <<EOF
'use client'
import * as ort from 'onnxruntime-web'
export default function App() {
console.log(ort.Tensor)
}
EOF
npx tscMake sure that tsconfig.json has "strict": true. If you change it so that it has "strict": false instead, the error goes away.
Urgency
This prevents using onnxruntime-web in default NextJS apps.
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.17.0
Execution Provider
'wasm'/'cpu' (WebAssembly CPU), 'webgpu' (WebGPU)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
platform:webissues related to ONNX Runtime web; typically submitted using templateissues related to ONNX Runtime web; typically submitted using template