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

compiled build with lokka is unfortunately large #32

Open
cainlevy opened this issue Feb 9, 2017 · 7 comments
Open

compiled build with lokka is unfortunately large #32

cainlevy opened this issue Feb 9, 2017 · 7 comments

Comments

@cainlevy
Copy link

cainlevy commented Feb 9, 2017

We noticed that after adding lokka and lokka-transport-http, our production build increased from ~75kb to ~500kb. I suspect it's the babel-runtime dependency.

@agentcooper
Copy link

agentcooper commented Feb 20, 2017

I created new react app (with create-react-app), added lokka and lokka-transport-http and then ran source-map-explorer on the build: http://i.imgur.com/JvCPKff.png.

It seems that huge size comes from iconv-lite, which is a dependency of node-fetch.

I ended up switching to apollo-client core, it is much smaller.

@cainlevy cainlevy changed the title babel-runtime dependency adds 400kb+ to compiled build node-fetch (?) dependency adds 400kb+ to compiled build Feb 20, 2017
@cainlevy cainlevy changed the title node-fetch (?) dependency adds 400kb+ to compiled build compiled build with lokka is unfortunately large Feb 20, 2017
@lanwin
Copy link

lanwin commented Apr 13, 2017

@kadirahq any thoughts on this issue? It seems node-fetch is also the root cause for #26 and there was the suggestion to replace node-fetch in example with isomorphic-fetch.

@asci
Copy link

asci commented Apr 22, 2017

@cainlevy @agentcooper if you use webpack you can add the following to your configuration:

{
  resolve: {
    alias: {
      'node-fetch': 'whatwg-fetch'
    }
  }
}

in this case, webpack will ignore dependency on node-fetch and will not bundle this package with all its dependencies (like huge iconv-lite).

Would be nice to add this to Readme file, what do you think? @arvitaly

@lanwin
Copy link

lanwin commented Apr 22, 2017

well this will not work when using react-create-app

@asci
Copy link

asci commented Apr 22, 2017

Unless you eject it. The react-create-app has its own tradeoffs — it is not flexible. Another option — get rid of node-fetch dependency at lokka-transport-http code level.

@lanwin
Copy link

lanwin commented Apr 22, 2017

Yes this was why I ask @kadirahq about his thoughts? If there are reasons not to switch from node-fetch to whatwg-fetch

@linus-amg
Copy link

thx @asci, this was super helpful, struggled with the bundle size as well

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

5 participants