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 export
ed js code?
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'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.