@@ -131,7 +131,7 @@ export async function createSFCModule(source : string, filename : AbstractPath,
131
131
132
132
// TBD: handle <script setup src="...
133
133
134
- const [ depsList , transformedScriptSource ] =
134
+ const [ bindingMetadata , depsList , transformedScriptSource ] =
135
135
await withCache (
136
136
compiledCache ,
137
137
[
@@ -167,18 +167,17 @@ export async function createSFCModule(source : string, filename : AbstractPath,
167
167
templateOptions : compileTemplateOptions ,
168
168
} ) ;
169
169
170
- // see https://github.com/vuejs/vue-loader/blob/12aaf2ea77add8654c50c8751bad135f1881e53f/src/templateLoader.ts#L54
171
- if ( compileTemplateOptions ?. compilerOptions !== undefined )
172
- compileTemplateOptions . compilerOptions . bindingMetadata = scriptBlock . bindings ;
173
-
174
-
175
170
// note:
176
171
// scriptBlock.content is the script code after vue transformations
177
172
// scriptBlock.scriptAst is the script AST before vue transformations
178
- return await transformJSCode ( scriptBlock . content , true , strFilename , [ ...contextBabelParserPlugins , ...additionalBabelParserPlugins ] , { ...contextBabelPlugins , ...additionalBabelPlugins } , log , devMode ) ;
173
+ return [ scriptBlock . bindings , ... await transformJSCode ( scriptBlock . content , true , strFilename , [ ...contextBabelParserPlugins , ...additionalBabelParserPlugins ] , { ...contextBabelPlugins , ...additionalBabelPlugins } , log , devMode ) ] ;
179
174
180
175
} ) ;
181
176
177
+ // see https://github.com/vuejs/vue-loader/blob/12aaf2ea77add8654c50c8751bad135f1881e53f/src/templateLoader.ts#L54
178
+ if ( compileTemplateOptions ?. compilerOptions !== undefined )
179
+ compileTemplateOptions . compilerOptions . bindingMetadata = bindingMetadata ;
180
+
182
181
await loadDeps ( filename , depsList , options ) ;
183
182
Object . assign ( component , interopRequireDefault ( createCJSModule ( filename , transformedScriptSource , options ) . exports ) . default ) ;
184
183
}
@@ -196,6 +195,7 @@ export async function createSFCModule(source : string, filename : AbstractPath,
196
195
compileTemplateOptions . compilerOptions . delimiters ,
197
196
compileTemplateOptions . compilerOptions . whitespace ,
198
197
compileTemplateOptions . compilerOptions . scopeId ,
198
+ compileTemplateOptions . compilerOptions . bindingMetadata ? Object . entries ( compileTemplateOptions . compilerOptions . bindingMetadata ) : '' ,
199
199
] ,
200
200
async ( { preventCache } ) => {
201
201
0 commit comments