I am trying to add custom js file using my custom module. But getting below error in console.
Uncaught ReferenceError: Plyr is not defined
DevTools failed to load SourceMap: Could not load content for http://localhost/magento/pub/static/version1592134088/frontend/Magento/luma/en_US/Vendor_Module/js/plyr.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
My code:
app\code\Vendor\Modle\view\frontend\requirejs-config.js
var config = {
 map: {
 '*': {
 plyr: 'Vendor_Module/js/plyr'
 }
 }
};
On phtml file
<script type="text/javascript">
require(['jquery','plyr'],function($){
 const player = new Plyr('#player1', {
 fullscreen:{ enabled: true, fallback: true, iosNative: true },
 controls:['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen', 'download']
 });
});
</script>
Does anyone have any solution? Thanks in advance.
 asked Jun 14, 2020 at 12:16
 
 
 
 Nayem323 
 
 7911 gold badge8 silver badges27 bronze badges
 
 - 
 did you delete static content? and deploy again?Sohel Rana– Sohel Rana2020年06月14日 12:26:13 +00:00Commented Jun 14, 2020 at 12:26
- 
 Yes, did run all commands that required.Nayem323– Nayem3232020年06月14日 12:36:03 +00:00Commented Jun 14, 2020 at 12:36
- 
 where you put your js file can you mention path here ?ParulThakkar– ParulThakkar2020年06月15日 06:36:26 +00:00Commented Jun 15, 2020 at 6:36
1 Answer 1
One minor error in .phtml file and that should be like bellow:
<script type="text/javascript">
 require(['jquery','plyr'],function(,ドルplyr){
 // logic here
 });
</script>
 answered Jun 15, 2020 at 5:31
 
 
 
 Bhashkar Karagthiya 
 
 364 bronze badges
 
 Explore related questions
See similar questions with these tags.
default