How to do ES6 classes with inheritance in separate files?

I want to do this in 1.2.1. I am not ready to go 1.3beta yet. Or maybe I should say the 1.3beta is not ready.

I tried this:


Foo = class Foo {


Bar = class Bar extends Foo {

But it fails with Foo not defined. I thought it could be because of load order, but putting Foo in _foo.js does not help.
If I remove bar.js I still get Foo in my global scope though…

_foo.js sorts after bar.js as well. It does look like you’re in load order territory here, so assuming all else is equal, try 0foo.js (or _bar.js).

(but you really should look at 1.3 :wink:)

Hmm, I thought _ was before the lower case letters… Thanks for the tip.

(And I did try 1.3beta-12, but my app crashed in all sorts of ways that I do not have time to investigate at the moment)

Technically it is, but the inbuilt file sorting on nix (at least on the version I’m using) uses a case insensitive collation and puts _ after a-z.

You’re right. 0foo.js works.