Skip to content

Commit

Permalink
Stop transpiling some builds to ES5
Browse files Browse the repository at this point in the history
This is built on top of #1425 itself built on top of #1420, which
removes most dependencies to webpack (besides tests, that we'll need to
also change anyway considering the fact that `karma-webpack` has an old
reported issue on macOS with our build).

We planned to release in our future 4.1.0 an ES5 version of our worker
file and as a lesser feature an ES5 "legacy" build (the one linked to release
notes - not the one published on npm).

Providing an ES5 version of our worker file was especially added to
support the `MULTI_THREAD` feature on PlayStation 4 devices.

However I sadly propose here that we roll back that attempt of support
(just of the `MULTI_THREAD` feature, the PlayStation 4 stay officially
supported and tested).

---

After multiple attempts (myself and then @Florent-Bouisset), we realized
the complexities and costs of maintaining a supplementary ES5 version of
builds.

We initially tried to switch from a webpack+babel mix to swc on a bundle
already produced by esbuild.
The global idea was to simplify our bundling process by designing an
architecturally simple and low-maintainance process made of a separate
bundling step then transpiling step on the bundling result.

But we realized that this philosophy doesn't seem to be compatible to
those tools. When combined with the fact that their documentation is
often either lacking or too complex, than some of our questionning to
maintainers led to poor answers and that the JS tooling ecosystem appears
to be still changing very fast, I'm not sure that I want to guarantee
support of ES5 for our hopefully long-lived v4 right now.
  • Loading branch information
peaBerberian committed Apr 30, 2024
1 parent 3f6a3ff commit 0845657
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 534 deletions.
6 changes: 0 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
## Unreleased

### Features

- Add a supplementary `worker.es5.js` file and its corresponding `EMBEDDED_WORKER_ES5`
embed to make the `MULTI_THREAD` experimental feature work on old browser environments
[#1400]

### Bug fixes

- Directfile/compat: On safari mobile in directfile mode, do not stay in an infinite
Expand Down
29 changes: 6 additions & 23 deletions doc/api/Miscellaneous/MultiThreading.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,29 +383,12 @@ if (currentModeInfo === null) {

## Note about ES5 Environment

By default, the Worker file will use es2017 features which should be compatible to a
majority of devices.
The Worker file will use es2017 features which should be compatible to a majority of
devices.

However, some older devices might not be compatible with it yet still compatible to the
WebWorker API (and thus the `MULTI_THREAD` feature), yet not with ES2017. For those
platforms, the RxPlayer also provide an ES5 variant of the Worker file:
WebWorker API (and thus the `MULTI_THREAD` feature), yet not with ES2017.

- The easiest way is to just import in your application its "embedded" version, exported
through the `"rx-player/experimental/features/embeds"` path:

```js
import { EMBEDDED_WORKER_ES5 } from "rx-player/experimental/features/embeds";
```

This allows to bypass the need to store and serve separately that file.

If you would prefer more control and a smaller bundle size, you may instead consider the
other following ways to it as a separate file.

- With every release note published on GitHub as `worker.es5.js` (you should only use the
file linked to the RxPlayer's version you're using),

- It is also available as `dist/worker.es5.js` from the root directory of the project
published on npm. As such, it might already be found in your project's directory, for
example in the `node_modules` directory (most probably in `node_modules/rx-player/dist/`
depending on your project).
If you need to provide support for the `MULTI_THREAD` feature on those platforms, we
recommend that you use a transpiler tool on that worker file to make it compatible to ES5.
Examples of transpiler tools are [babel](https://babeljs.io/) and [swc](https://swc.rs/).
319 changes: 0 additions & 319 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0845657

Please sign in to comment.