YouTube.js icon indicating copy to clipboard operation
YouTube.js copied to clipboard

04369be Transforming for-await loops to the configured target environment ("chrome58") is not supported yet

Open darktohka opened this issue 1 year ago • 2 comments

Steps to reproduce

  1. Clone https://github.com/FreeTubeApp/FreeTube
  2. Install youtubei.js from git: "youtubei.js": "git+https://github.com/LuanRT/YouTube.js.git"
  3. Run yarn to install new version of youtubei.js

Failure Logs

$ npm run build

> [email protected] build
> npm run clean && npm run build:parser-map && npm run build:proto && npm run build:esm && npm run bundle:node && npm run bundle:browser && npm run bundle:browser:prod && npm run bundle:cf-worker && npm run bundle:react-native


> [email protected] clean
> npx rimraf ./dist/src ./dist/package.json ./bundle/browser.js ./bundle/browser.js.map ./bundle/browser.min.js ./bundle/browser.min.js.map ./bundle/node.cjs ./bundle/node.cjs.map ./bundle/cf-worker.js ./bundle/cf-worker.js.map ./bundle/react-native.js ./bundle/react-native.js.map ./deno


> [email protected] build:parser-map
> node ./dev-scripts/gen-parser-map.mjs


> [email protected] build:proto
> npx pb-gen-ts --entry-path="src/proto" --out-dir="src/proto/generated" --ext-in-import=".js"


> [email protected] build:esm
> npx tspc


> [email protected] bundle:node
> npx esbuild ./dist/src/platform/node.js --bundle --target=node10 --keep-names --format=cjs --platform=node --outfile=./bundle/node.cjs --external:jintr --external:undici --external:linkedom --external:tslib --sourcemap --banner:js="/* eslint-disable */"

▲ [WARNING] "import.meta" is not available in the configured target environment ("node10") and will be empty [empty-import-meta]

    dist/src/platform/node.js:14:17:
      14 │ const meta_url = import.meta.url;
         ╵                  ~~~~~~~~~~~

1 warning

  bundle/node.cjs      799.7kb
  bundle/node.cjs.map  421.6kb


> [email protected] bundle:browser
> npx esbuild ./dist/src/platform/web.js --banner:js="/* eslint-disable */" --bundle --target=chrome58 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser

✘ [ERROR] Transforming async generator functions to the configured target environment ("chrome58") is not supported yet

    dist/src/utils/Utils.js:150:7:
      150 │ export async function* streamToIterable(stream) {
          ╵        ~~~~~

✘ [ERROR] Transforming for-await loops to the configured target environment ("chrome58") is not supported yet

    dist/src/utils/FormatUtils.js:69:24:
      69 │                     for await (const chunk of streamToIterable(body)) {
         ╵                         ~~~~~

2 errors
node:child_process:928
    throw err;
    ^

Error: Command failed: /home/user/.cache/yarn/v6/.tmp/b7cb1d7f5afd6e596452e45de0844cba.0ec6ab5a39cfad86c0239f6c3437d0258d1c0ef9.prepare/node_modules/esbuild-linux-64/bin/esbuild ./dist/src/platform/web.js --banner:js=/* eslint-disable */ --bundle --target=chrome58 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:889:11)
    at Object.execFileSync (node:child_process:925:15)
    at Object.<anonymous> (/home/user/.cache/yarn/v6/.tmp/b7cb1d7f5afd6e596452e45de0844cba.0ec6ab5a39cfad86c0239f6c3437d0258d1c0ef9.prepare/node_modules/esbuild/bin/esbuild:177:28)
    at Module._compile (node:internal/modules/cjs/loader:1504:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 60467,
  stdout: null,
  stderr: null
}

Expected behavior

The browser build succeeds.

Current behavior

The browser build fails.

Version

Default

Anything else?

Suggest updating the browser target environment to chrome63 where async generators were implemented.

Checklist

  • [X] I am running the latest version.
  • [X] I checked the documentation and found no answer.
  • [X] I have searched the existing issues and made sure this is not a duplicate.
  • [X] I have provided sufficient information.

darktohka avatar Jul 31 '24 17:07 darktohka

Proposed PR to fix this issue and #716: #718

darktohka avatar Jul 31 '24 17:07 darktohka

@darktohka Don't install directly from GitHub, if you clone and build it separately and then add the built version to FreeTube it works correctly.

absidue avatar Jul 31 '24 18:07 absidue