diff --git a/mediapipe/tasks/web/audio/BUILD b/mediapipe/tasks/web/audio/BUILD index 409836800..4dd5a2f6b 100644 --- a/mediapipe/tasks/web/audio/BUILD +++ b/mediapipe/tasks/web/audio/BUILD @@ -43,7 +43,23 @@ rollup_bundle( entry_point = "index.ts", format = "esm", output_dir = False, - sourcemap = "false", + sourcemap = "true", + deps = [ + ":audio_lib", + "@npm//@rollup/plugin-commonjs", + "@npm//@rollup/plugin-node-resolve", + "@npm//@rollup/plugin-terser", + "@npm//google-protobuf", + ], +) + +rollup_bundle( + name = "audio_bundle_cjs", + config_file = "//mediapipe/tasks/web:rollup.config.mjs", + entry_point = "index.ts", + format = "cjs", + output_dir = False, + sourcemap = "true", deps = [ ":audio_lib", "@npm//@rollup/plugin-commonjs", @@ -76,6 +92,7 @@ pkg_npm( "wasm/audio_wasm_nosimd_internal.js", "wasm/audio_wasm_nosimd_internal.wasm", ":audio_bundle", + ":audio_bundle_cjs", ":package_json", ], ) diff --git a/mediapipe/tasks/web/package.json b/mediapipe/tasks/web/package.json index 89c9a599e..3f495d151 100644 --- a/mediapipe/tasks/web/package.json +++ b/mediapipe/tasks/web/package.json @@ -2,7 +2,9 @@ "name": "@mediapipe/tasks-__NAME__", "version": "__VERSION__", "description": "__DESCRIPTION__", - "main": "__NAME___bundle.js", + "main": "__NAME___bundle_cjs.js", + "browser": "__NAME___bundle.js", + "module": "__NAME___bundle.js", "author": "mediapipe@google.com", "license": "Apache-2.0", "types": "__TYPES__", diff --git a/mediapipe/tasks/web/text/BUILD b/mediapipe/tasks/web/text/BUILD index 08cbb8672..f68a8c9f5 100644 --- a/mediapipe/tasks/web/text/BUILD +++ b/mediapipe/tasks/web/text/BUILD @@ -44,7 +44,23 @@ rollup_bundle( entry_point = "index.ts", format = "esm", output_dir = False, - sourcemap = "false", + sourcemap = "true", + deps = [ + ":text_lib", + "@npm//@rollup/plugin-commonjs", + "@npm//@rollup/plugin-node-resolve", + "@npm//@rollup/plugin-terser", + "@npm//google-protobuf", + ], +) + +rollup_bundle( + name = "text_bundle_cjs", + config_file = "//mediapipe/tasks/web:rollup.config.mjs", + entry_point = "index.ts", + format = "cjs", + output_dir = False, + sourcemap = "true", deps = [ ":text_lib", "@npm//@rollup/plugin-commonjs", @@ -78,5 +94,6 @@ pkg_npm( "wasm/text_wasm_nosimd_internal.wasm", ":package_json", ":text_bundle", + ":text_bundle_cjs", ], ) diff --git a/mediapipe/tasks/web/vision/BUILD b/mediapipe/tasks/web/vision/BUILD index 10e98de8b..a7767fe53 100644 --- a/mediapipe/tasks/web/vision/BUILD +++ b/mediapipe/tasks/web/vision/BUILD @@ -55,7 +55,23 @@ rollup_bundle( entry_point = "index.ts", format = "esm", output_dir = False, - sourcemap = "false", + sourcemap = "true", + deps = [ + ":vision_lib", + "@npm//@rollup/plugin-commonjs", + "@npm//@rollup/plugin-node-resolve", + "@npm//@rollup/plugin-terser", + "@npm//google-protobuf", + ], +) + +rollup_bundle( + name = "vision_bundle_cjs", + config_file = "//mediapipe/tasks/web:rollup.config.mjs", + entry_point = "index.ts", + format = "cjs", + output_dir = False, + sourcemap = "true", deps = [ ":vision_lib", "@npm//@rollup/plugin-commonjs", @@ -89,5 +105,6 @@ pkg_npm( "wasm/vision_wasm_nosimd_internal.wasm", ":package_json", ":vision_bundle", + ":vision_bundle_cjs", ], )