提交 aacf9d5b 编写于 作者: fxy060608's avatar fxy060608

fix(mp): Compatible with vite@3

上级 766d08e5
...@@ -231,7 +231,10 @@ export function updateMiniProgramComponentsByMainFilename( ...@@ -231,7 +231,10 @@ export function updateMiniProgramComponentsByMainFilename(
return return
} }
const bindingComponents = parseBindingComponents( const bindingComponents = parseBindingComponents(
templateDescriptor.bindingComponents, {
...templateDescriptor.bindingComponents,
...scriptDescriptor.setupBindingComponents,
},
scriptDescriptor.bindingComponents scriptDescriptor.bindingComponents
) )
const imports = parseImports( const imports = parseImports(
...@@ -341,7 +344,9 @@ interface ParseDescriptor { ...@@ -341,7 +344,9 @@ interface ParseDescriptor {
resolve: PluginContext['resolve'] resolve: PluginContext['resolve']
isExternal: boolean isExternal: boolean
} }
export interface ScriptDescriptor extends TemplateDescriptor {} export interface ScriptDescriptor extends TemplateDescriptor {
setupBindingComponents: BindingComponents
}
async function parseGlobalDescriptor( async function parseGlobalDescriptor(
filename: string, filename: string,
...@@ -386,10 +391,12 @@ export async function parseScriptDescriptor( ...@@ -386,10 +391,12 @@ export async function parseScriptDescriptor(
options.resolve options.resolve
) )
: [] : []
const descriptor = { const descriptor: ScriptDescriptor = {
bindingComponents: parseComponents(ast), bindingComponents: parseComponents(ast),
setupBindingComponents: findBindingComponents(ast.body),
imports, imports,
} }
scriptDescriptors.set(filename, descriptor) scriptDescriptors.set(filename, descriptor)
return descriptor return descriptor
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册