The goal is to create a bower
compatible package.
I'm new to packaging, did some research but no clue yet.
The problem is simplified as below:
\src\ID.js
\src\Person.js
ID.js
export default class ID {
static gen() {
return 'a unique ID';
}
}
Person.js
import ID from './ID.js';
export default class Person {
constructor(name) {
this.name = name;
this.id = ID.gen();
}
}
The only class should be exposed is Person
, ID
will only be used internally.
If I want to create a package named person
, then I would assume it's better to build all the source files into one.
I know a little bit of merging using ES5, but with ES6 classes, I have no idea.
Maybe I could create a parent object to hold these two classes? But I would really like to know the proper way. If no such way, I would also take something like compiling ES6 to ES5 methods.