diff --git a/package.json b/package.json index 3b99c5c0f6..f52d8a7e7a 100644 --- a/package.json +++ b/package.json @@ -145,10 +145,10 @@ "build:dev": "./scripts/generate_build.mjs --dev-mode", "build:wasm:debug": "mkdir -p dist && cd ./src/parsers/manifest/dash/wasm-parser && cargo build --target wasm32-unknown-unknown && cp target/wasm32-unknown-unknown/debug/mpd_node_parser.wasm ../../../../../dist/mpd-parser.wasm", "build:wasm:release": "./scripts/build_wasm_release.sh", - "bundle": "./scripts/run_bundler.mjs src/index.ts --production-mode -o dist/rx-player.js", - "bundle:min": "./scripts/run_bundler.mjs src/index.ts --production-mode -o dist/rx-player.min.js --minify", - "bundle:min:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode -o dist/rx-player.min.js --minify --watch", - "bundle:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode -o dist/rx-player.js --watch", + "bundle": "./scripts/run_bundler.mjs src/index.ts --production-mode --globals -o dist/rx-player.js", + "bundle:min": "./scripts/run_bundler.mjs src/index.ts --production-mode --globals -o dist/rx-player.min.js --minify", + "bundle:min:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode --globals -o dist/rx-player.min.js --minify --watch", + "bundle:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode --globals -o dist/rx-player.js --watch", "certificate": "./scripts/generate_certificate", "check": "npm run check:types && npm run lint && npm run check:types:unit_tests", "check:all": "npm run check:types && npm run lint && npm run lint:demo && npm run lint:tests && npm run test:unit && npm run test:integration && npm run test:memory && node -r esm ./scripts/check_nodejs_import_compatibility.js", diff --git a/scripts/run_bundler.mjs b/scripts/run_bundler.mjs index 3ba392a626..e92c46a47b 100755 --- a/scripts/run_bundler.mjs +++ b/scripts/run_bundler.mjs @@ -42,6 +42,7 @@ if (import.meta.url === pathToFileURL(process.argv[1]).href) { const shouldWatch = args.includes("-w") || args.includes("--watch"); const shouldMinify = args.includes("-m") || args.includes("--minify"); const production = args.includes("-p") || args.includes("--production-mode"); + const globalScope = args.includes("-g") || args.includes("--globals"); const silent = args.includes("-s") || args.includes("--silent"); let outfile; @@ -66,6 +67,7 @@ if (import.meta.url === pathToFileURL(process.argv[1]).href) { watch: shouldWatch, minify: shouldMinify, production, + globalScope, silent, outfile, }); @@ -187,6 +189,7 @@ Available options: -o , --output Specify an output file for the ES2017 bundle. To ignore to skip ES2017 bundle generation. -p, --production-mode Build all files in production mode (less runtime checks, mostly). + -g, --globals Add the RxPlayer to the global scope. -g, --global-scope If set, enable "global scope mode" (the \`__GLOBAL_SCOPE__\` global symbol) on the bundle. -s, --silent Don't log to stdout/stderr when bundling