question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

webpack TypeError: EngineClass is not a constructor

See original GitHub issue

Description

I try to setup videojs-record and its dependencies using npm & webpack. I had some issues with proper webpack setup, but I followed https://github.com/collab-project/videojs-record/issues/212 and https://github.com/collab-project/videojs-record/issues/136, and they helped me. But in the end when I tried to initialize the device (click on camera button) I got new error.

EngineClass = _video2.default.RecordRTCEngine; // returns undefined

Feels like there is some issue with RecordRTC setup.

This is my webpack code:

plugins: [
        new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))),
        new ExtractTextPlugin(env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css'),
        new ManifestPlugin({
            publicPath: output.publicPath,
            writeToFileEmit: true
        }),
        new webpack.ProvidePlugin({
            videojs: 'video.js/dist/video.js', 'window.videojs': 'video.js',
            RecordRTC: 'recordrtc', 'window.RecordRTC': 'recordrtc'
        }),
    ],

    resolve: {
        extensions: settings.extensions,
        modules: [
            resolve(settings.source_path),
            'node_modules'
        ],
        alias: {
            videojs: 'video.js'
        }

This is how I import libs:

    import * as videojs   from 'video.js';
    import * as RecordRTC from 'recordrtc';
    import 'webrtc-adapter';
    import 'videojs-record/dist/videojs.record.js'

Player initialization:

<video id="auth-video-player" class="video-js vjs-default-skin vjs-big-play-centered"></video>
     const player = videojs('auth-video-player', {
                // video.js options
                controls: false,
                loop: false,
                fluid: true,
                plugins: {
                    // videojs-record plugin options
                    record: {
                        video: true,
                        maxLength: 60,
                        debug: true
                    }
                }
            });

Results

Expected

Record initializes successfully

Actual

Error gets thrown

Error output

   TypeError: EngineClass is not a constructor
    at Record.onDeviceReady (videojs.record.js?73a2:2195)

Additional Information

videojs

7.0.2

videojs-record

2.3.0

browsers

Chrome 66.0

OSes

MacOS-HighSierra

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
oleg-kiviljovcommented, May 23, 2018

setup that you introduced in documentation has worked successfully for me

0reactions
thijstriemstracommented, Jun 3, 2018

note that video.cjs.js

Looks like this will change again soon: https://github.com/videojs/video.js/pull/5220/files

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack imported module is not a constructor - Stack Overflow
If you are not the library author and are having a problem consuming another library, you may be seeing an error like this:...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
"[Class] is not a constructor" error using JsonServiceClient
I am creating a React/Redux application using Typescript 2.1.4 and ES6 (using babel-polyfill and webpack). I get the following error when attempting to...
Read more >
webpack is not a constructor | The AI Search Engine You Control
BlockI don't want to see this, for any search. Feedback. What do you think of this? TypeError: webpack.DefinePlugin is not a constructor.
Read more >
Class is not a Constructor - Laracasts
... export default class Counter { constructor(){ console.log('init. ... file I'm getting: "main.js:5 Uncaught TypeError: Counter is not a constructor".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found