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 use this plugin in require.js #399

Open
DoomTay opened this issue Jun 13, 2018 · 3 comments
Open

Can't use this plugin in require.js #399

DoomTay opened this issue Jun 13, 2018 · 3 comments
Labels

Comments

@DoomTay
Copy link

DoomTay commented Jun 13, 2018

Description

Include a short description of the problem you are seeing here.

Steps to Reproduce

http://jsfiddle.net/uy9680os/1/

Expected Results

"player.ads" should show a function

Actual Results

Error: Script error for "video.js", needed by: add-video-js-in-global-scope and a failed attempt to load http://fiddle.jshell.net/_display/video.js

Versions

videojs-contrib-ads version: 6.4.1

Video-js version: 7.0.5

Platforms

Browsers: Firefox 60.0.2

OS/Devices: Windows 10

It seems the issue is that early on, the videojs-contrib-ads script contains factory(require('video.js')) and define(['video.js']. If that is changed to videojs, that should fix the issue

@incompl
Copy link
Contributor

incompl commented Jul 6, 2018

I believe you mean Require.js rather than React.js in the title, yes? It appears this issue is inherited from generator-videojs-plugin. I have opened an issue there. When a fix is available upstream we'll update to get it.

@incompl incompl added the bug label Jul 6, 2018
@DoomTay DoomTay changed the title Can't use this plugin in react.js Can't use this plugin in require.js Jul 6, 2018
@DoomTay
Copy link
Author

DoomTay commented Jul 6, 2018

Whoops. Fixed the title.

@brandonocasey
Copy link
Contributor

brandonocasey commented Jul 11, 2018

We cannot change the require call on our end from video.js to videojs because the module name is actually video.js on npm, and other bundlers look at that.

I think we need to configure requirejs to set video.js as videojs in the paths configuration. Then use the map configuration to map any require of video.js to configured videojs module. This is all to work-around the the name since requirejs thinks that video.js is a reference to a local javascript file when it is not.

Working example: https://jsfiddle.net/uy9680os/57/ .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants