Lessons are not displayed in the console: es6 and meteor

I am using grigio:babel

es6 to send to meteor. I have a simple file named camera.es6

to provide camera functionality

if (Meteor.isClient) {
  class Camera {
    constructor() {
    getStream() {
      return new Promise(function (resolve, reject) {
        navigator.webkitGetUserMedia({ video: true }, resolve, reject);


Then go to my browser console and try a new camera instance.

var c = new Camera()
VM1898:2 Uncaught ReferenceError: Camera is not defined
    at <anonymous>:2:13
    at Object.InjectedScript._evaluateOn (<anonymous>:905:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:838:34)
    at Object.InjectedScript.evaluate (<anonymous>:694:21)


Shouldn't the camera be available? Babel seems to be saying that he should just translate it into a functionally similar structure to make it work in ES5. I also tried running it in babel repl and it translated perfectly

How can I access my classes using meteor and es6?


source to share

1 answer

I suppose babel wraps whatever you code in a closure, so you can't get to the camera from the console. Try to do something like this

window.Camera = Camera;


After class definition



All Articles