Open cainlevy opened 7 years ago
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.
@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.
@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
well this will not work when using react-create-app
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.
Yes this was why I ask @kadirahq about his thoughts? If there are reasons not to switch from node-fetch to whatwg-fetch
thx @asci, this was super helpful, struggled with the bundle size as well
We noticed that after adding
lokka
andlokka-transport-http
, our production build increased from ~75kb to ~500kb. I suspect it's thebabel-runtime
dependency.