graphql-query-compress icon indicating copy to clipboard operation
graphql-query-compress copied to clipboard

The compress method doesn't work using regular ES6 import statements

Open imolorhe opened this issue 7 years ago • 3 comments

For the compress method to work, I had to use import * as compress from 'graphql-query-compress'. Simply doing import compress from 'graphql-query-compress' didn't work. I believe this is due to the fact that module.exports is used instead of export default in the src file of the method.

imolorhe avatar Jan 11 '18 01:01 imolorhe

@imolorhe I sent a PR, I think will solve your problem.

RodolfoSilva avatar Feb 11 '18 13:02 RodolfoSilva

@rse, can you look my PRs? 😄

RodolfoSilva avatar Feb 11 '18 13:02 RodolfoSilva

You absolutely want to avoid default exports, always use named exports. It makes ESM/CJS interrop a lot easier and enables tree shaking if you end up exporting multiple things.

jaydenseric avatar Mar 07 '19 23:03 jaydenseric