Useraccounts:core dependence on t9n

I believe that useraccounts:core is no longer maintained so posting this here.

Using the new bundle analyser tool, I see that 7% of the size of my bundle is coming from:

This package takes a whopping 171kb somehow. And since I don’t use translation, having this package is completely unnecessary. Apart from changing the useraccounts:core package code. Is there anything we can do to fix that?

Yes, you are right. We reduce the size of the app by adjusting this package and many others.

We cloned the T9n package to packages directory and then adjusted the package.js file. Meteor then imports our version instead of the atmosphere one.

T9n uses an array to import all the language files. There’s an env var to set this value in the app but it doesn’t work with latest versions of meteor.

1 Like

Thanks. That worked. Bundle size is 5% smaller now :slight_smile:

I started the accounts-t9n (t9n) package. I did not test it with Meteor 1.5 yet. @lxdi: Which env var is not working? Feel free to open an issue. I would like to take a look into this in the next days after work.

There is also a long open issue that t9n consumes too much bandwidth, I hope with dynamic imports this could be solved more easy now.

On the other hand I don’t know if useraccounts:core would be updated to a newer version of t9n, it seemes they are 6 versions behind at the moment, so lxdi’s workaround is the best solution for the moment. @lxd: If you think your solution could work for everyone I would be happy to merge a PR.

Hi @softwarerero, our solution is the same that is proposed at the T9n github README about T9N_LANGUAGES env var. We could not make it work so we copied the folder to packages directory.

This method breaks the autoupdate of the packages, but we simply have a script to update all the git folders in the packages directory.

You’re welcome @elie. When we modify a package, first we create a separate branch and then merge the updates. This is extra work but we can control the versions of the includes and sometimes the files included. With this method and importing dinamically some files we reduced from 3.5MB to 1.4MB (860KB gzipped). Adding service worker is another technique to cache some files (the second time a user loads the page 250KB are loaded) but it’s not yet supported in Safari.

How are you caching with service worker? Like this?

Any other packages you cut down on heavily by forking them?

This was the only one that seemed like a really obvious candidate in my

Yes, that’s it.

We reduced some space removing okgrow:analytics and using only mixpanel. Also removed one of the two versions of jquery (~100KB), we had both atmosphere and npm versions (we use Blaze and some npm packages that uses it).

Finally I got to this. t9n should now be running as a plain npm package, allowing to selectively import only the needed language files. The functionality exists on a branch now which has to be tested and better documented before this goes life.

Feel free to have a look at In examples/npm is a demo application that shows how it could work.

Your link points to 2.0 version. But I found also a 2.3 version in another repo. This last one seem to be npm only, right?

On your documentation though, it stil claims the only solution for reducing package size and uploading only the desired laaguanges is to clone the package. Which? Atmosphere package? haven’t it moved to npm?

You can either use the Atmosphere package or the npm package, it does no make sense to use both at the same time.

The Atmosphere package comes with all the languages included, you have less initialization work at the cost of a bigger bundle size.

If you prefer a smaller bundle I recommend to use the npm version only. You can find an example in this repository how to initialize it and import language files at the client and server:

1 Like