mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
修复 windows 平台 npm run dist 任务异常的问题 (#301)
This commit is contained in:
@@ -7,6 +7,8 @@ const path = require('path');
|
||||
const components = require('./get-components')();
|
||||
const dependencyTree = require('dependency-tree');
|
||||
|
||||
const SEP = path.sep;
|
||||
|
||||
components.forEach(componentName => {
|
||||
const libDir = path.resolve(__dirname, '../../lib');
|
||||
const content = analyzeDependencies(componentName, libDir).map(component => `require('../../vant-css/${component}.css');`);
|
||||
@@ -19,7 +21,7 @@ function analyzeDependencies(componentName, libDir) {
|
||||
search(dependencyTree({
|
||||
directory: libDir,
|
||||
filename: path.resolve(libDir, componentName, 'index.js'),
|
||||
filter: path => path.indexOf('vant/lib/') !== -1
|
||||
filter: path => path.indexOf(`vant${SEP}lib${SEP}`) !== -1
|
||||
}), checkList);
|
||||
return checkList.filter(component => checkComponentHasStyle(component));
|
||||
}
|
||||
@@ -27,7 +29,7 @@ function analyzeDependencies(componentName, libDir) {
|
||||
function search(tree, checkList) {
|
||||
tree && Object.keys(tree).forEach(key => {
|
||||
search(tree[key], checkList);
|
||||
const component = key.split('/vant/lib/')[1].replace('/index.js', '').replace('mixins/', '');
|
||||
const component = key.split(`${SEP}vant${SEP}lib${SEP}`)[1].replace(`${SEP}index.js`, '').replace(`mixins${SEP}`, '');
|
||||
if (checkList.indexOf(component) === -1) {
|
||||
checkList.push(component);
|
||||
}
|
||||
|
Reference in New Issue
Block a user