fix(vant-cli): fix Windows system build style problems (#5655)

This commit is contained in:
yinhui1129754
2020-02-14 14:37:19 +08:00
committed by GitHub
parent 9371bc06c8
commit 1d8e2654f5
3 changed files with 9 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
* Build style entry of all components
*/
import { join, relative } from 'path';
import { sep, join, relative } from 'path';
import { outputFileSync } from 'fs-extra';
import { getComponents, replaceExt } from '../common';
import { CSS_LANG, getCssBaseFile } from '../common/css';
@@ -72,7 +72,7 @@ function genEntry(params: {
}
content += depsPath.map(template).join('\n');
content = content.replace(new RegExp('\\' + sep, 'g'), '/');
outputFileSync(outputFile, content);
});
}

View File

@@ -1,4 +1,4 @@
import { join } from 'path';
import { relative, sep, join } from 'path';
import { CSS_LANG } from '../common/css';
import { existsSync } from 'fs-extra';
import { getDeps, clearDepsCache, fillExt } from './get-deps';
@@ -6,10 +6,9 @@ import { getComponents, smartOutputFile } from '../common';
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
function matchPath(path: string, component: string): boolean {
return path
.replace(SRC_DIR, '')
.split('/')
.includes(component);
const p = relative(SRC_DIR, path);
const arr = p.split(sep);
return arr.includes(component);
}
function getStylePath(component: string) {