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

Provide ES5 version of the worker file #1400

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Commits on Mar 8, 2024

  1. Provide ES5 version of the worker file

    The `MULTI_THREAD` experimental feature rely on a Worker file which use
    ES2017 features.
    
    The most relied on way to import this file is through its "embedded
    version", which is usually not processed by bundlers/compilers of the
    application so it could be translated to a more compatible (usually
    older) version of JavaScript.
    
    Yet, we're encountering on the PlayStation 4 a case where the
    `MULTI_THREAD` feature may be used, the device is compatible to
    the WebWorker web API, but does not understand all of ES2017 features
    (let alone ES2015 features).
    
    For those devices, and because we could still want to be able to rely on
    ES2017 for the vast majority of devices that do support it, I propose a
    solution where we provide a supplementary Worker file that is compiled
    down to ES5.
    
    I rel on webpack instead of esbuild for this because esbuild does not
    target es5 easily.
    
    I'm not very confident of my webpack skills - even more considering that
    Worker environments have some constraints and I'm not sure of every
    web+JS features that babel + webpack might use, but hopefully, this
    should work (I'll test it).
    
    There are several downsides coming with this commit:
    
      1. Webpack takes several seconds on my PC to compile the worker files.
    
         As our building process was before relatively fast, this "slowness"
         is now visible during build, where "Bundling worker files..." is
         the slowest step on my PC.
    
      2. Because I'm not that confident on the file outputted, I decided to
         re-run all integration tests running in `MULTI_THREAD` mode both on
         the regular and the ES5 version of that script. This means that
         integration tests will take much more time to complete.
    peaBerberian committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    f2b56aa View commit details
    Browse the repository at this point in the history