From 0858c0499ea8374ef339d3713d8195c200ec9b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 12 Dec 2019 11:18:26 +0800 Subject: [PATCH] fix(cli): skip install should not skip export --- .../src/compiler/gen-package-entry.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/vant-cli/src/compiler/gen-package-entry.ts b/packages/vant-cli/src/compiler/gen-package-entry.ts index 840e837ad..c647ca12e 100644 --- a/packages/vant-cli/src/compiler/gen-package-entry.ts +++ b/packages/vant-cli/src/compiler/gen-package-entry.ts @@ -28,22 +28,20 @@ function genExports(names: string[]): string { } export function genPackageEntry(options: Options) { + const names = getComponents(); const vantConfig = getVantConfig(); - const components = getComponents(); - const skipInstall = get(vantConfig, 'build.skipInstall', []); + const skipInstall = get(vantConfig, 'build.skipInstall', []).map(pascalize); - const names = components - .filter(item => !skipInstall.includes(item)) - .map(item => pascalize(item)); - - const content = `${genImports(components, options)} + const components = names.map(pascalize); + const content = `${genImports(names, options)} const version = '${version}'; -const components = [ - ${names.join(',\n ')} -]; function install(Vue) { + const components = [ + ${components.filter(item => !skipInstall.includes(item)).join(',\n ')} + ]; + components.forEach(item => { if (item.install) { Vue.use(item); @@ -60,7 +58,7 @@ if (typeof window !== 'undefined' && window.Vue) { export { install, version, - ${genExports(names)} + ${genExports(components)} }; export default {