From e9a2a0e428c02631498c66e2bee51dbaa2752956 Mon Sep 17 00:00:00 2001 From: Reginald Alfret Date: Wed, 23 Sep 2026 20:52:23 +0530 Subject: [PATCH] fix(js): copy onnxruntime-web .mjs files alongside .wasm in webpack configs (fixes #519, #461) Signed-off-by: Reginald Alfret --- js/ort-whisper/webpack.config.js | 7 +++++-- js/quick-start_onnxruntime-web-bundler/webpack.config.js | 7 +++++-- js/sd-turbo/webpack.config.js | 6 +++++- js/segment-anything/webpack.config.js | 6 +++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/js/ort-whisper/webpack.config.js b/js/ort-whisper/webpack.config.js index 0665e993e..59d1d9bea 100644 --- a/js/ort-whisper/webpack.config.js +++ b/js/ort-whisper/webpack.config.js @@ -17,8 +17,11 @@ module.exports = () => { } }, plugins: [new CopyPlugin({ - // Use copy plugin to copy *.wasm to output folder. - patterns: [{ from: 'node_modules/onnxruntime-web/dist/*.wasm', to: '[name][ext]' }] + // Use copy plugin to copy *.wasm and *.mjs to output folder. + patterns: [ + { from: 'node_modules/onnxruntime-web/dist/*.wasm', to: '[name][ext]' }, + { from: 'node_modules/onnxruntime-web/dist/*.mjs', to: '[name][ext]' } + ] })], mode: 'production' } diff --git a/js/quick-start_onnxruntime-web-bundler/webpack.config.js b/js/quick-start_onnxruntime-web-bundler/webpack.config.js index 0fa8dd551..0975ac15e 100644 --- a/js/quick-start_onnxruntime-web-bundler/webpack.config.js +++ b/js/quick-start_onnxruntime-web-bundler/webpack.config.js @@ -16,8 +16,11 @@ module.exports = () => { } }, plugins: [new CopyPlugin({ - // Use copy plugin to copy *.wasm to output folder. - patterns: [{ from: 'node_modules/onnxruntime-web/dist/*.wasm', to: '[name][ext]' }] + // Use copy plugin to copy *.wasm and *.mjs to output folder. + patterns: [ + { from: 'node_modules/onnxruntime-web/dist/*.wasm', to: '[name][ext]' }, + { from: 'node_modules/onnxruntime-web/dist/*.mjs', to: '[name][ext]' } + ] })], mode: 'production' } diff --git a/js/sd-turbo/webpack.config.js b/js/sd-turbo/webpack.config.js index def2dfd2e..eb6b83321 100644 --- a/js/sd-turbo/webpack.config.js +++ b/js/sd-turbo/webpack.config.js @@ -23,13 +23,17 @@ export default { }, }, plugins: [ - // Copy .wasm files to dist folder + // Copy .wasm and .mjs files to dist folder new CopyWebpackPlugin({ patterns: [ { from: 'node_modules/onnxruntime-web/dist/*.wasm', to: 'dist/[name][ext]' }, + { + from: 'node_modules/onnxruntime-web/dist/*.mjs', + to: 'dist/[name][ext]' + }, ], }), ], diff --git a/js/segment-anything/webpack.config.js b/js/segment-anything/webpack.config.js index def2dfd2e..eb6b83321 100644 --- a/js/segment-anything/webpack.config.js +++ b/js/segment-anything/webpack.config.js @@ -23,13 +23,17 @@ export default { }, }, plugins: [ - // Copy .wasm files to dist folder + // Copy .wasm and .mjs files to dist folder new CopyWebpackPlugin({ patterns: [ { from: 'node_modules/onnxruntime-web/dist/*.wasm', to: 'dist/[name][ext]' }, + { + from: 'node_modules/onnxruntime-web/dist/*.mjs', + to: 'dist/[name][ext]' + }, ], }), ],