webpack TypeError: EngineClass is not a constructor
See original GitHub issueDescription
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:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
setup that you introduced in documentation has worked successfully for me
Looks like this will change again soon: https://github.com/videojs/video.js/pull/5220/files