twitter.com/mgechev
How do we pick the split points?
Slide 21
Slide 21 text
twitter.com/mgechev
often subjectively
Slide 22
Slide 22 text
twitter.com/mgechev
sometimes based on data
Slide 23
Slide 23 text
twitter.com/mgechev
- Manual
- Error-Prone
but always…
Slide 24
Slide 24 text
twitter.com/mgechev
Step 1: Open
https://example.com/
Step 2: Determine JavaScript
which is likely to be required
Step 3: Download the
chunks
Step 4: Store chunks
in browser cache
Pre-fetching
Slide 25
Slide 25 text
twitter.com/mgechev
How do we pick the priorities of the
bundles to pre-fetch?
Slide 26
Slide 26 text
twitter.com/mgechev
Slide 27
Slide 27 text
twitter.com/mgechev
Lazy-load everything!
Slide 28
Slide 28 text
twitter.com/mgechev
Lazy-load everything!
…and let tooling take care of the rest
Slide 29
Slide 29 text
twitter.com/mgechev
Slide 30
Slide 30 text
twitter.com/mgechev
/a
/a/a /a/b
/b
/b/a
/
Slide 31
Slide 31 text
twitter.com/mgechev
/a
/a/a /a/b
/b
/b/a
/
Slide 32
Slide 32 text
twitter.com/mgechev
/a
/a/a /a/b
/b
/b/a
/
Slide 33
Slide 33 text
twitter.com/mgechev
/a
/a/a /a/b
/b
/b/a
/
Slide 34
Slide 34 text
twitter.com/mgechev
Slide 35
Slide 35 text
twitter.com/mgechev
Slide 36
Slide 36 text
twitter.com/mgechev
route-based splitting
Slide 37
Slide 37 text
twitter.com/mgechev
&
Slide 38
Slide 38 text
twitter.com/mgechev
$ npm run build
# For Create React App
$ serve -s build
# For Angular CLI
$ serve -s dist
Slide 39
Slide 39 text
twitter.com/mgechev
Let’s emulate *really* bad conditions
Slide 40
Slide 40 text
twitter.com/mgechev
Slide 41
Slide 41 text
twitter.com/mgechev
Slide 42
Slide 42 text
twitter.com/mgechev
Let’s take a look at the GA graph
Slide 43
Slide 43 text
twitter.com/mgechev
Slide 44
Slide 44 text
twitter.com/mgechev
Slide 45
Slide 45 text
twitter.com/mgechev
- Main & Settings in same chunk
‣ Update of the source code
- Pre-fetch FAQ when the user is at Home
‣ Custom logic
Possible optimizations