Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Stop relying on webpack for legacy bundles generation #1425

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ module.exports = {
__LOGGER_LEVEL__: {
CURRENT_LEVEL: '"NONE"',
},
__GLOBAL_SCOPE__: false,
},
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "webpack --progress --config webpack.config.mjs --env production",
"bundle:min": "webpack --progress --config webpack.config.mjs --env minify --env production",
"bundle:min:watch": "webpack --progress --config webpack.config.mjs -w --env production --env minify",
"bundle:watch": "webpack --progress --config webpack.config.mjs -w --env production",
"bundle": "./scripts/run_bundler.mjs src/index.ts --production-mode --es5 dist/rx-player.js",
"bundle:min": "./scripts/run_bundler.mjs src/index.ts --production-mode --es5 dist/rx-player.js --minify",
"bundle:min:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode --es5 dist/rx-player.js --minify --watch",
"bundle:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode --es5 dist/rx-player.js -- watch",
"certificate": "./scripts/generate_certificate",
"check": "npm run check:types && npm run lint",
"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",
Expand Down
6 changes: 4 additions & 2 deletions scripts/build_demo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import { pathToFileURL } from "url";
import esbuild from "esbuild";
import rootDirectory from "./utils/project_root_directory.mjs";
import getHumanReadableHours from "./utils/get_human_readable_hours.mjs";
import buildWorker from "./bundle_worker.mjs";
import runBundler from "./run_bundler.mjs";

const WORKER_IN_FILE = join(rootDirectory, "src/worker_entry_point.ts");
const DEMO_OUT_FILE = join(rootDirectory, "demo/full/bundle.js");
const WORKER_OUT_FILE = join(rootDirectory, "demo/full/worker.js");
const WASM_FILE_DEPENDENCY = join(rootDirectory, "dist/mpd-parser.wasm");
Expand Down Expand Up @@ -73,7 +74,7 @@ export default function buildDemo(options) {
}
});

buildWorker({
runBundler(WORKER_IN_FILE, {
watch,
minify,
production: !isDevMode,
Expand Down Expand Up @@ -128,6 +129,7 @@ export default function buildDemo(options) {
__LOGGER_LEVEL__: JSON.stringify({
CURRENT_LEVEL: "INFO",
}),
__GLOBAL_SCOPE__: JSON.stringify(true),
},
})
.then((context) => {
Expand Down
247 changes: 0 additions & 247 deletions scripts/bundle_worker.mjs

This file was deleted.

11 changes: 8 additions & 3 deletions scripts/generate_build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as path from "path";
import { fileURLToPath, pathToFileURL } from "url";
import { rimraf } from "rimraf";
import generateEmbeds from "./generate_embeds.mjs";
import buildWorker from "./bundle_worker.mjs";
import runBundler from "./run_bundler.mjs";

const currentDirectory = path.dirname(fileURLToPath(import.meta.url));

Expand All @@ -35,6 +35,10 @@ const BUILD_ARTEFACTS_TO_REMOVE = [
"src/__GENERATED_CODE",
];

const WORKER_IN_FILE = path.join(ROOT_DIR, "src/worker_entry_point.ts");
const WORKER_OUT_FILE = path.join(ROOT_DIR, "dist/worker.js");
const ES5_WORKER_OUT_FILE = path.join(ROOT_DIR, "dist/worker.es5.js");

// If true, this script is called directly
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
const { argv } = process;
Expand Down Expand Up @@ -79,12 +83,13 @@ async function generateBuild(options = {}) {

console.log(" 👷 Bundling worker files...");
await Promise.all([
buildWorker({
runBundler(WORKER_IN_FILE, {
watch: false,
minify: !devMode,
outfile: WORKER_OUT_FILE,
es5Outfile: ES5_WORKER_OUT_FILE,
production: !devMode,
silent: true,
es5: true,
}),
]);

Expand Down
Loading
Loading