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

Can't resolve imports in video.es.js with yarn v2 / berry #7209

Closed
rtritto opened this issue Apr 26, 2021 · 1 comment · Fixed by #7263
Closed

Can't resolve imports in video.es.js with yarn v2 / berry #7209

rtritto opened this issue Apr 26, 2021 · 1 comment · Fixed by #7263

Comments

@rtritto
Copy link

rtritto commented Apr 26, 2021

Description

I'm using yarn v2 with videojs.
During compiling, I get different import errors on video.js/dist/video.es.js file.

How to fix

Add @videojs/vhs-utils, m3u8-parser, mpd-parser and mux.js in video.js package.json dependencies or change/update code of video.js/dist/video.es.js file.

Workaround

Add in .yarnrc.yml file:

packageExtensions:
  'video.js@*':
    dependencies:
      '@videojs/vhs-utils': '*'
      'm3u8-parser': '*'
      'mpd-parser': '*'
      'mux.js': '*'

Steps to reproduce

  1. video.js in package.json
  2. Run yarn install
  3. Compile

Results

Expected

Compile success.

Actual

On compiling, I get these errors:

...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:26:0
Module not found: Can't resolve '@videojs/vhs-utils/es/resolve-url.js'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:27:0
Module not found: Can't resolve 'm3u8-parser'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:28:0
Module not found: Can't resolve '@videojs/vhs-utils/es/codecs.js'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:29:0
Module not found: Can't resolve '@videojs/vhs-utils/es/media-types.js'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:30:0
Module not found: Can't resolve 'mpd-parser'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:31:0
Module not found: Can't resolve 'mux.js/lib/tools/parse-sidx'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:32:0
Module not found: Can't resolve '@videojs/vhs-utils/es/id3-helpers'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:33:0
Module not found: Can't resolve '@videojs/vhs-utils/es/containers'
...
error - .yarn/cache/video.js-npm-7.12.1-53ac059ebb-e371896a4d.zip/node_modules/video.js/dist/video.es.js:34:0
Module not found: Can't resolve '@videojs/vhs-utils/es/byte-helpers'
...

Additional Information

versions

video.js: 7.11.8, 7.12.1

yarn: 2.4.1

webpack: 4.46.0, 5.36.2

OS

Windows

@gkatsev
Copy link
Member

gkatsev commented Apr 27, 2021

I'm not sure whether I just haven't ran it properly or because I still had a package-lock that yarn used or something, but I've had a sample project I used where yarn+berry was able to resolve things properly.
However, given the other issues we've seen with yarn, I do think that we likely need to declare the dependencies from @videojs/http-streaming (VHS) as dependencies of video.js because we inline VHS into Video.js for the dist files, except for some of the dependencie.
An alternative is to inline the dependencies as well, but, there is a likelyhood that someone could be using one of those modules themselves, so, deduplication of modules would be beneficial there.

gkatsev added a commit that referenced this issue Jun 7, 2021
gkatsev added a commit that referenced this issue Jun 7, 2021
Because VHS is inlined into Video.js, we should depend on what VHS
depends on.

Fixes #7091, fixes #7209, fixes #7144, fixes #7109
gkatsev added a commit that referenced this issue Jun 8, 2021
Because VHS is inlined into Video.js, we should depend on what VHS
depends on.

Fixes #7091, fixes #7209, fixes #7144, fixes #7109
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
edirub pushed a commit to edirub/video.js that referenced this issue Jun 8, 2023
Because VHS is inlined into Video.js, we should depend on what VHS
depends on.

Fixes videojs#7091, fixes videojs#7209, fixes videojs#7144, fixes videojs#7109
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants