Skip to content

Commit e9afba6

Browse files
committed
linting
1 parent cce8f8b commit e9afba6

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
<br/>
3232
</div>
3333

34-
👉 [Usage](#usage) | [API](#api) | [Server side](#ssr)
34+
👉 [Usage](#usage) | [API](#api) | [SSR](#ssr) | [Concurrent loading](#concurrent-loading)
3535

3636

3737
Key features:
3838
- 1️⃣ Single source of truth - your __bundler drives__ everything.
3939
- 📖 __library__ level code __splitting__
4040
- 🧙️ Hybrid and __Prerendering__ compatible
4141
- 💡 __TypeScript__ bindings
42-
- ⚛️ __React.Lazy__ underneath
42+
- ⚛️ __React.Lazy__ underneath (if hot module updates are disabled)
4343
- 🌟 Async on client, sync on server. Supports __Suspense__ (even on server side)
4444
- 📦 could work with __any bundler__ - webpack, rollup, parcel or puppeteer - it does not matter
4545

@@ -53,7 +53,7 @@ Key features:
5353
- 📦 and yes - this is the only __parcel-bundler compatible__ SSR-friendly React code splitting library
5454

5555
👍 Better than [React.Lazy](https://reactjs.org/docs/code-splitting.html#reactlazy):
56-
- It __IS__ Lazy, just with some stuff around
56+
- It __IS__ Lazy, just with some stuff around*
5757
- SSR, Prerendering and Preloading support.
5858
- With or without Suspense, and easier Error cases support.
5959

@@ -66,7 +66,7 @@ Key features:
6666
👌 Not as good with
6767
- Loads chunks only after the `main one`, as long as loader code is bundled inside the main chunk, so it should be loaded first.
6868
- Not an issue with the `progressive hydration`, and might provide a better UX via feature detection.
69-
- Provides 👨‍🔬 technological workaround
69+
- Provides 👨‍🔬 technological workaround - [see here](#concurrent-loading)
7070

7171
<a name="usage"/>
7272

@@ -283,7 +283,9 @@ Before rendering your application you have to ensure - all parts are loaded.
283283
`rehydrateMarks` accepts a list of `marks` from a server side(`drainHydrateMarks`), loads all
284284
necessary chunks and then resolves.
285285

286-
## A VERY IMPORTANT MOMENT
286+
<a name="concurrent-loading"/>
287+
288+
## A VERY IMPORTANT MOMENT - Concurrent Loading
287289
All other code splitting libraries are working a bit differently - they amend `webpack` building process,
288290
gathering information about how the final chunks are assembled, and __injects the real scripts and styles__ to the server response,
289291
thus all scripts, used to render something on the Server would be loaded in a parallel in on Client.
@@ -438,11 +440,17 @@ React-imported-component break this cycle, making ServerSide rendering sync, and
438440
comprehensive ways to rehydrate rendered tree on client.
439441
It will detect server-side environment and precache all used components.
440442

441-
###Bundler independent SSR
443+
### Bundler independent SSR
442444
It does not matter how do you bundle your application - it could be even browser. The secrect sause is a __cli__ command, to extract all your imports into imports map, and use it later to load chunks by request.
443445
- You might even dont have any separated chunk on the server side - it would still works.
444446
- You might even ship module/nomodule scripts, using, for example, [devolution](https://github.com/theKashey/devolution) - no additional configuration would be required.
445447

448+
### Not using React.Lazy with React-Hot-Loader
449+
There is design limitation with React.lazy support from RHL size, so they could not be reloaded without
450+
state loss if `lazy` is created not in the user space. At it would be created inside imported.
451+
452+
If React-Hot-Loader is detected `lazy` switches to `imported async` mode, this behaves absolutely the same.
453+
446454
## Other loaders
447455
Another loaders exists, and the only difference is in API, and how they manage (or not manage) SSR.
448456

src/babel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import {resolve, relative, dirname} from 'path';
2-
import {encipherImport} from './utils';
2+
// @ts-ignore
3+
import * as crc32 from "crc-32";
4+
5+
export const encipherImport = (str: string) => crc32.str(str).toString(32);
36

47
// Babel v7 compat
58
let syntax: any;

src/utils.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// @ts-ignore
2-
import * as crc32 from 'crc-32';
31
import {Default} from "./types";
42

53
type ObjectOrFunction = object | (() => any);
@@ -18,6 +16,4 @@ export const es6import = (module: any) => (
1816
module.default
1917
? module.default
2018
: module
21-
);
22-
23-
export const encipherImport = (str: string) => crc32.str(str).toString(32);
19+
);

0 commit comments

Comments
 (0)