mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-25 10:56:35 +08:00
fix(cli): missing style deps if component doesn't have style
This commit is contained in:
parent
5389bcf4fb
commit
b9a077b779
@ -1,4 +1,5 @@
|
|||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
import { existsSync } from 'fs-extra';
|
||||||
import { smartOutputFile } from '../common';
|
import { smartOutputFile } from '../common';
|
||||||
import { CSS_LANG, getCssBaseFile } from '../common/css';
|
import { CSS_LANG, getCssBaseFile } from '../common/css';
|
||||||
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
|
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
|
||||||
@ -27,12 +28,17 @@ export function genPacakgeStyle(options: Options) {
|
|||||||
.map((name: string) => {
|
.map((name: string) => {
|
||||||
let path = join(SRC_DIR, `${name}/index${ext}`);
|
let path = join(SRC_DIR, `${name}/index${ext}`);
|
||||||
|
|
||||||
|
if (!existsSync(path)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (options.pathResolver) {
|
if (options.pathResolver) {
|
||||||
path = options.pathResolver(path);
|
path = options.pathResolver(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return `@import "${path}";`;
|
return `@import "${path}";`;
|
||||||
})
|
})
|
||||||
|
.filter((item: string) => !!item)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
|
|
||||||
smartOutputFile(options.outputPath, content);
|
smartOutputFile(options.outputPath, content);
|
||||||
|
@ -99,7 +99,7 @@ export async function genStyleDepsMap() {
|
|||||||
|
|
||||||
const map = {} as DepsMap;
|
const map = {} as DepsMap;
|
||||||
|
|
||||||
components.filter(checkStyleExists).forEach(component => {
|
components.forEach(component => {
|
||||||
map[component] = analyzeComponentDeps(component);
|
map[component] = analyzeComponentDeps(component);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user