lock icon indicating copy to clipboard operation
lock copied to clipboard

Find a way to reduce the 556KB minified version

Open IvanRave opened this issue 11 years ago • 63 comments

IvanRave avatar Jan 30 '15 03:01 IvanRave

yes.

cristiandouce avatar Jan 30 '15 05:01 cristiandouce

Related:

auth0/lock#66 auth0/lock#102

cristiandouce avatar Jan 30 '15 05:01 cristiandouce

610 ko for login widget in production , wouch !!!

benjipott avatar Sep 21 '15 11:09 benjipott

Any news here ? Auth0 lock represents 50% of my front-end JS :-(

By the way, I'm using jQuery, does anyone here knows if there is a way to avoid the double download of sizzle ?

romainbessugesmeusy avatar Oct 23 '15 19:10 romainbessugesmeusy

is it possible to modularize the lock into lock core + bunch of optional modules? with bundled-all module as well as for me, for some projects I don't need social identity providers at all

moravcik avatar Nov 27 '15 19:11 moravcik

We are working on the modularization @moravcik suggests. You'll be able to bundle the Lock without the support for the connections you don't need (social, enterprise, etc.) and also without the CSS.

Having that said, the Lock is intended to be a drop in solution for our customers. It has a lot of features that you may not need and supports extensive customization. For that reason, we recommend users to build their own UI when they want to keep the resources of their web sites as small as possible.

gnandretta avatar Nov 30 '15 14:11 gnandretta

I just ran into this. Auth0 is 50% of my front-end app right now as well. :/

Suggestion: Load as much as possible lazily rather than up-front. Most web applications that are going to use the drop-in widget won't be popping it up to the user immediately, though some JavaScript on the page may require the API be available during startup. By only pulling in the basic JS up front and lazily downloading the UI later would allow the user's application to be available immediately and at worst they get a small spinner if they get the auth pop-up too quickly after page load.

MicahZoltu avatar Jan 02 '16 20:01 MicahZoltu

We just ran into this as well, however the CDN minified version is ~155k. Using browserify with a require('auth0-lock') gets me the 556kb version. We're sticking with the CDN for now.

NiXXeD avatar Apr 26 '16 18:04 NiXXeD

Any idea how the CDN version is built?

jzaefferer avatar Apr 26 '16 18:04 jzaefferer

Hi @NiXXeD and @jzaefferer,

The script in the CDN is built with the grunt task that is published in this repo. It uses browserify to make the bundle and uglify to minify it. The script is bigger than the ~155k that are actually transferred because the response is compressed with gzip. You can configure your web server to do the same.

gnandretta avatar Apr 26 '16 20:04 gnandretta

Turns out the non-gzipped size (which is a lot easier to compare here) is 729kb. So the CDN build is even worse.

jzaefferer avatar Apr 28 '16 11:04 jzaefferer

some ideas

I think it will help to know where is the size going, like having a graph.. for instance which dependency is bigger. I just tried to remove underscore and I think the result doesn't worth the hassle:

  • auth0-lock.min.js: 692K
  • auth0-lock.min.js.gz: 148K

what can we do to figure where is the space going?

The inlined css does takes a big chunk of this:

  • lib/css/main.min.css: 182K
  • lib/css/main.min.css.gz: 33K

Is there a way to write this css better? is there something we can remove from there?

jfromaniello avatar Apr 28 '16 12:04 jfromaniello

I would put focus on Lock10 at this point

woloski avatar Apr 28 '16 12:04 woloski

I would put focus on Lock10 at this point

Is there any way to track that? I found a v10 label, but its not in use, and there are no milestones.

jzaefferer avatar Apr 28 '16 13:04 jzaefferer

Any news here?

I want to use Auth0-Lock (v10.0.2) with my Aurelia application. I'm not using React at all but including auth0-lock from NPM installs React as a dependency. When analyzing the size of my minified application I get this result:

react: 672.58 KB (21.4%)
auth0-lock: 470.15 KB (15.0%)
auth0-js: 72.42 KB (2.30%)

If I understand correctly, the minified output from auth0 is 1215 KB (excluding React dependency results in a 542 KB auth0 package). That is LARGE. The CDN file is "only" 670 KB in a minified version. It includes the React dep so how come my NPM installed auth0-lock weighs in at a massive 1 215 KB?

At the moment I'm only using a very simple embedded login form with one social media connector. Can I create this buttom myself and install some bare minimum auth0 package without UI?

mikeesouth avatar Aug 09 '16 21:08 mikeesouth

yes https://github.com/auth0/auth0.js

woloski avatar Aug 17 '16 10:08 woloski

+1 for modularising lock. We are only using the most basic username/password login/reset features. 500kb is crazy and like many businesses, we don't have the time to roll our own lighter weight alternative.

screen shot 2017-01-03 at 18 41 55

dcworldwide avatar Jan 03 '17 08:01 dcworldwide

any news? Because this module is really huge.

It could have something like a light version, because is not everybody that needs all of the features.

jvbianchi avatar Apr 03 '17 00:04 jvbianchi

@jvbianchi not yet. Lots to figure it out still.. 😅

luisrudge avatar Apr 03 '17 00:04 luisrudge

Is there another issue blocking this issue?

jvbianchi avatar Apr 03 '17 00:04 jvbianchi