New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make it available as a commonjs module #12
Conversation
I have a similar patch I'm working with. Instead of looking for exports at the end, I wrap the The benefit of doing it this way, is you can use joli for two separate connections/databases. The downside is, this forces Joli to be a CommonJS module. Any thoughts on how to have it flexable (checking for exports, so it isn't required to be used as a CommonJS module) yet keeping the e.g., my code is:
|
I think both ideas can join like so: if (exports) {
exports.create = function() {
return joli;
};
} |
Unfortunately, that doesn't allow you to have two separate |
Maybe:
Then, you can get a new Joli instance by calling |
Oh right.
Its about the same thing, just a different approach. |
But that doesn't give you parity for existing apps, since For example, if someone isn't using CommonJS, they would now have to use:
That's why I suggested a separate function |
Correct. Maybe just one minor change then:
|
Cool, that works great. |
Hi guys, I have just pushed a variation of your common work :
This allows to either load the library the way we did before:
or the new way:
Thanks both for the contribution! |
Thanks Xavier. The one change that isn't captured in your update is the ability to use Joli on two separate databases, because The parsing of CommonJS modules may be cached, so the root-level For example:
|
No description provided.