facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.4k stars 1.82k forks source link

how to reduce bundle size by hack __generated__ file #2276

Open Ai01 opened 6 years ago

Ai01 commented 6 years ago

a

you can see, there has too many generated files in the project. it makes the bundle size too big.Anyone find a way to slove this question?

this result come from dev environment, it hasn't been gzip. In my opinion, the important thing is: generated file has the same size with the source code, maybe bigger than business code. and l guess these file slow down the webpack bundle speed.(l will try to prove it by number)

edvinerikson commented 6 years ago

The source file is usually large but if you measure the gzipped size they will be much smaller. Parsing time for these files shouldn't be a problem either.

kassens commented 6 years ago

To make the diffs more meaningful when the generated files are checked in, we also include the full query text. Did you check that the file was minified to strip the comments and gzipped to reduce the redundancy?

alloy commented 6 years ago

@kassens Does the babel plugin strip those comments for production builds?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

narajaon commented 2 years ago

Any news about this issue ?

gajus commented 1 year ago

Related https://github.com/facebook/relay/issues/4038

Hypnosphi commented 12 months ago

To make the diffs more meaningful when the generated files are checked in, we also include the full query text. Did you check that the file was minified to strip the comments and gzipped to reduce the redundancy?

The full query text is not actualy a comment, at least not with Relay v16. it is a params.text field on the default export instead. Can this be disabled in production if I gitignore the generated files?