fix(js): copy onnxruntime-web .mjs files alongside .wasm in webpack configs - #586
Open
Reginald Alfret V (reginaldalfret) wants to merge 1 commit into
Conversation
…onfigs (fixes microsoft#519, microsoft#461) Signed-off-by: Reginald Alfret <reginaldalfret@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In
js/sd-turbo,js/segment-anything,js/ort-whisper, andjs/quick-start_onnxruntime-web-bundler, webpack was configured to only copynode_modules/onnxruntime-web/dist/*.wasmto the distribution directory. However, onnxruntime-web with WebGPU/JSEP and threaded WASM requires companion.mjsmodules (such asort-wasm-simd-threaded.jsep.mjsandort-wasm-simd-threaded.mjs) at runtime. Because these.mjsfiles were missing fromdist/, running the web examples in browser failed with:TypeError: Failed to resolve module specifier dist/ort-wasm-simd-threaded.jsep.mjs(#519)or
failed to fetch ort-wasm-simd-threaded.mjs(#461).This PR updates the Webpack configuration for all 4 JS examples to copy both
*.wasmand*.mjsfiles fromnode_modules/onnxruntime-web/dist/to the destination directory.Motivation and Context
Fixes #519
Fixes #461
Verification
npm run buildinjs/sd-turboafter installing dependencies, verifying that all.mjsfiles (includingort-wasm-simd-threaded.jsep.mjsandort-wasm-simd-threaded.mjs) along with.wasmbinaries are copied properly intodist/.git diff --check.