mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
perf(cli): code split documents (#11111)
This commit is contained in:
parent
a2d1280044
commit
a0d07a373b
@ -1,12 +1,7 @@
|
|||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import { join, parse } from 'path';
|
import { join, parse } from 'path';
|
||||||
import { existsSync, readFileSync, readdirSync } from 'fs';
|
import { existsSync, readFileSync, readdirSync } from 'fs';
|
||||||
import {
|
import { pascalize, getVantConfig, normalizePath } from '../common/index.js';
|
||||||
isDev,
|
|
||||||
pascalize,
|
|
||||||
getVantConfig,
|
|
||||||
normalizePath,
|
|
||||||
} from '../common/index.js';
|
|
||||||
import {
|
import {
|
||||||
SRC_DIR,
|
SRC_DIR,
|
||||||
DOCS_DIR,
|
DOCS_DIR,
|
||||||
@ -80,10 +75,7 @@ function genImportDocuments(items: DocumentItem[]) {
|
|||||||
return items
|
return items
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
const path = normalizePath(item.path);
|
const path = normalizePath(item.path);
|
||||||
if (isDev()) {
|
return `const ${item.name} = () => import('${path}');`;
|
||||||
return `const ${item.name} = () => import('${path}');`;
|
|
||||||
}
|
|
||||||
return `import ${item.name} from '${path}';`;
|
|
||||||
})
|
})
|
||||||
.join('\n');
|
.join('\n');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user