Exporting a class with ES6 (Babel)

Browserify is meant to be fed a single “entry point” file, through which it recursively traverses all of your require statements, importing the code from other modules. So you should be require‘ing the _babel.js versions of modules, not _browserified.js ones.

From the looks of it, you intend for your app’s “entry point” to be demos/helicopter_game/PlayState_browserified.js, yeah? If that’s the case:

  • In PlayState.js, change it to import {Game} from "../../lib/pentagine_babel.js";.
  • In Gruntfile.js, remove "lib/pentagine_browserified.js": "lib/pentagine_babel.js".

Works for me. Let me know if that suffices or I am misunderstanding your requirements here.

P.S. You can use babelify to avoid having separate Grunt tasks for Babel and Browserify. See my answer here for an example.

Leave a Comment

techhipbettruvabetnorabahisbahis forumuedueduedueduedueduedueduseduedu