diff --git a/packages/vant-cli/src/commands/build.ts b/packages/vant-cli/src/commands/build.ts index d848cb3ce..c3c19503a 100644 --- a/packages/vant-cli/src/commands/build.ts +++ b/packages/vant-cli/src/commands/build.ts @@ -12,7 +12,7 @@ import { compileBundles } from '../compiler/compile-bundles.js'; import { genPackageEntry } from '../compiler/gen-package-entry.js'; import { genStyleDepsMap } from '../compiler/gen-style-deps-map.js'; import { genComponentStyle } from '../compiler/gen-component-style.js'; -import { SRC_DIR, LIB_DIR, ES_DIR } from '../common/constant.js'; +import { SRC_DIR, LIB_DIR, ES_DIR, getVantConfig } from '../common/constant.js'; import { genPackageStyle } from '../compiler/gen-package-style.js'; import { genWebStormTypes } from '../compiler/web-types/index.js'; import { @@ -135,9 +135,10 @@ async function buildPackageStyleEntry() { } async function buildBundledOutputs() { + const config = getVantConfig(); setModuleEnv('esmodule'); await compileBundles(); - genWebStormTypes(); + genWebStormTypes(config.build?.tagPrefix); } const tasks = [ diff --git a/packages/vant-cli/src/compiler/web-types/index.ts b/packages/vant-cli/src/compiler/web-types/index.ts index 74eaf46d8..ff5bc6dd6 100644 --- a/packages/vant-cli/src/compiler/web-types/index.ts +++ b/packages/vant-cli/src/compiler/web-types/index.ts @@ -40,7 +40,7 @@ export async function parseAndWrite(options: Options) { ); } -export function genWebStormTypes() { +export function genWebStormTypes(tagPrefix?: string) { const pkgJson = getPackageJson(); const vantConfig = getVantConfig(); @@ -50,5 +50,6 @@ export function genWebStormTypes() { test: /README\.md/, version: pkgJson.version, outputDir: LIB_DIR, + tagPrefix, }); } diff --git a/packages/vant/vant.config.mjs b/packages/vant/vant.config.mjs index 7e127b6ab..622f5ab66 100644 --- a/packages/vant/vant.config.mjs +++ b/packages/vant/vant.config.mjs @@ -2,6 +2,7 @@ export default { name: 'vant', build: { srcDir: 'src', + tagPrefix: 'van-', namedExport: true, skipInstall: ['lazyload'], packageManager: 'pnpm',