-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
[RFC] Bundle size optimization #1034
Comments
Feathers only uses language features that are natively supported by Node 6 or later. Unfortunately ES modules are not part of ES6 and not supported by Node yet. Size wise, the authentication client will likely be much smaller in the next version and the sorting utility could manually be put somewhere else. It is indeed not needed in Feathers core. |
The end goal is bundle size optimization, the imports were merely a suggestion of one possible strategy for achieving it. Optimization should be possible with the constraint of Node 6 (or later) functionality. |
By the way -- you could still ship a transpiled build that supports Node v6 if you wanted to take advantage of newer JS features. |
I think a lot can be gained here from the client in the next version of authentication, moving the sorting mechanism somewhere else and #932. The reasons for dropping Babel compilation (it was used in pre Buzzard) have been outlined in #608 although some (like installing directly from GitHub) do not apply to the monorepo anymore. I'm not opposed to adding a compilation step again but in that case, migrating the codebase to TypeScript (#565) - which is more well-defined than most non-standard ES features - would make more sense to me. |
As discussed in #1028, all @feathersjs namespaced modules (with the exception of
@feathersjs/client
) ship as ES modules, and it is the responsibility of users consuming these modules to compile them as necessary.Surprisingly,
@feathersjs/*
packages are my 4th largest dependency.Since we are already shipping ES modules, why not take advantage of language features such as import/export syntax, and then setting
{sideEffects: false}
in package.json files so you can get tree shaking?One of the biggest files that is imported in the client is commons/lib/utils.js. This file is just a group of utility functions. It's the type of file that could potentially have a smaller footprint with tree-shaking.
Speaking to my particular use case, here is every file I import from the @feathersjs namespace sorted by filesize:
The text was updated successfully, but these errors were encountered: