-
Notifications
You must be signed in to change notification settings - Fork 65
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
tree-shake bundle step #119
Comments
CC @timsuchanek |
The tutorial Heroku app with Prisma came to 80mb in size today. |
our Heroku app is 314MB 😳 |
@chrisdrackett You are using the Prisma plugin, correct? Does that number include the node_modules? |
not sure, its just what Heroku tells me:
not super worried about it yet, still trying to get it to even work :D |
@chrisdrackett ok, and with Prisma plugin right? |
yep! |
closes #167 While this may not seem like an improvement for end-users, but rather an internal refactor, the user-facing part is in how it helps support #119. It turned out that codename uses some dynamic requires that rollup commonjs plugin cannot understand. This does mean that users will see a less pretty name when creating new projects in non-empty directories. Very minor thing that we can revisit.
@Weakky and I both got nexus apps to be bundled and work after by rollup tonight. At 10mb, it represents a 9.7x/970% decrease! |
Update
|
Use tree shaking and aggressive optimizations to create Nexus apps that are as small as possible. This means NOT shipping Nexus server side apps with the traditional source+node_modules but an optimized combination of these. Reasons this is desirable:
Baselines
Here are the current baselines for the
hello-world
andplugin-prisma
examplesTODOs
Try webpack
Try Rollup
Get Rollup producing a functioning build
see here: https://github.com/graphql-nexus/examples/tree/spike/tree-shaking/hello-world
Rollup QuestionsFind way to bundle lodash in friendly way. Currently we have to used namedExoprts feature of rollup. Imagine user brought the dep. Forgot tree-shaking for a moment, we just want their app to be bundle-able. And its not right now.When node module, like prisma plugin is marked as external dep, how does the user go to production with the resulting bundle? If the external dep is a Node builtin, its fine, since presumably wherever they deploy to will have Node and thus the builtin, but what about third party node modules? Example where we just install and use the prisma plugin (which doesn't have esm builds yet):prisma plugin
nexus build --bundle
to integration- graceful bail?
- where to put bundle?
- keep ts build around too?
- or, no ts emit, instead rollup ts plugin approach?
tool for Nexus plugin authors to build their plugin with esm build out of the box --> Create Nexus tooling graphql-nexus/nexus#862
nonexus start
given that we now have a bundle step, making output less predictable?resolve circ dep warnings coming from Nexus (run examples branch bundle script to see) --> Remove circular deps from codebase #853
resolve unused dep warnings (that give us no context about where...) (SOQ)Allow promises to be returned in a field in the resolver of connection graphql-nexus/nexus#853improve how Nexus uses eval https://rollupjs.org/guide/en/#avoiding-eval (may not matter if all the locations are tree-shaked anyways, however, its a nice touch anyways) --> Improve eval usage #856
The text was updated successfully, but these errors were encountered: