0

I have a package with some handy functions like

function func1() { ... }

function func2() { ... }

Then I try to import them via

import 'packagename'

But in my code below I cannot use func1() and func2() as they are undefined

Is it possible to import non exported js code?

2
  • Whats the package? What are the functions? Commented Oct 15, 2018 at 4:23
  • recordrtc. There are 2 functions that I need: RecordRTC & setSrcObject Commented Oct 15, 2018 at 4:24

1 Answer 1

2

You can see on the README of RecordRTC here: https://github.com/muaz-khan/RecordRTC#npm-install it has:

var RecordRTC = require('recordrtc');
var Whammy = RecordRTC.Whammy;
var WhammyRecorder = RecordRTC.WhammyRecorder;
var StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
// and so on

var video = new Whammy.Video(100);
var recorder = new StereoAudioRecorder(stream, options);

To do the same thing via import you need to do:

import RecordRTC from 'recordrtc'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.