Skip to content

Commit fe39c8b

Browse files
committed
embed help into async-requires
1 parent 8eec893 commit fe39c8b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ CLI command `imported-components [sources ROOT] [targetFile.js]` (use .ts for Ty
234234
When you will execute this command - all `imports` among your codebase would be found and extracted to a file provided.
235235
This will gave ability to orchestrate code-splitting later.
236236

237+
If you need to search inside more that one top-level directory - just define more command, saving information into more than one target file.
238+
237239
> The current implementation will discover and use all `imports`, even // commented ones
238240
239241
## 3. Start using `imported`, `lazy` or `useImported`

src/scanners/scanForImports.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,17 @@ function scanTop(root: string, start: string, target: string) {
125125
pWriteFile(target, `
126126
/* eslint-disable */
127127
/* tslint:disable */
128+
129+
// generated by react-imported-component, DO NOT EDIT
128130
129131
import {assignImportedComponents} from 'react-imported-component/boot';
130132
133+
// all your imports are defined here
134+
// all, even the ones you tried to hide in comments (that's the cost of making a very fast parser)
135+
// to remove any import from here
136+
// 1) use magic comment \`import(/* client-side */ './myFile')\` - and it will disappear
137+
// 2) use file filter to ignore specific locations (refer to the README)
138+
131139
const applicationImports = [
132140
${
133141
Object
@@ -145,6 +153,8 @@ ${
145153
if (module.hot) {
146154
// these imports would make this module a parent for the imported modules.
147155
// but this is just a helper - so ignore(and accept!) all updates
156+
157+
// @ts-ignore
148158
module.hot.accept(() => null);
149159
}
150160
`)

0 commit comments

Comments
 (0)