I have a code base written using ES5, and I want to update just part of the code to ES6 using Modules. This is the code I have:
goog.module('farm.animal.Cow');
// Legacy class using es5
var Animal = goog.require('namespace.Animal');
class Cow extends Animal {
constructor() {
super();
}
}
exports = Cow;
and this is the legacy class
goog.provide('namespace.Animal');
namespace.Animal = function() {
};
I tried to follow the migration recommendations on the GitHub Wikis of both projects:
https://github.com/google/closure-compiler/wiki/Migrating-from-goog.modules-to-ES6-modules
but no luck so far. Most of the time I get the following error:
depstree.NamespaceNotFoundError: Namespace "namespace.Animal" never provided.
Does anyone have any idea about how should be the proper way to migrate the code? What am I doing wrong?