Skip to content
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

ES6 export doesn't work with module export plugin #35

Closed
daffl opened this issue Jan 7, 2016 · 1 comment
Closed

ES6 export doesn't work with module export plugin #35

daffl opened this issue Jan 7, 2016 · 1 comment

Comments

@daffl
Copy link
Member

daffl commented Jan 7, 2016

The module exports plugin does not work with the current index.js like this:

import * as hooks from './hooks';
import service from './service';

export { hooks };
export { service };
export default service;

The plugin only seems to work with a single export default. This basically means that nothing will work as documented in a non ES6 setup. The tests that verifies this in the other db adapters is:

it('is CommonJS compatible', () => {
  assert.equal(typeof require('../lib'), 'function');
});

Which is missing here. Changing the index file to

import * as hooks from './hooks';
import service from './service';

service.hooks = hooks;
// for backwards compatibility
service.service = service;

export default service;

should fix it.

@daffl
Copy link
Member Author

daffl commented Jan 8, 2016

Actually, the tests was there but wrong. expect(typeof require('../lib').default).to.equal('function'); should be expect(typeof require('../lib')).to.equal('function'); this will still work as the default with ES6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant