@@ -122,10 +122,22 @@ export async function compileFile(
122
122
ssrCode += code
123
123
}
124
124
125
+ const ceFilter = store . sfcOptions . script ?. customElement || / \. c e \. v u e $ /
126
+ function isCustomElement ( filters : typeof ceFilter ) : boolean {
127
+ if ( typeof filters === 'boolean' ) {
128
+ return filters
129
+ }
130
+ if ( typeof filters === 'function' ) {
131
+ return filters ( filename )
132
+ }
133
+ return filters . test ( filename )
134
+ }
135
+ let isCE = isCustomElement ( ceFilter )
136
+
125
137
let clientScript : string
126
138
let bindings : BindingMetadata | undefined
127
139
try {
128
- const res = await doCompileScript ( store , descriptor , id , false , isTS , isJSX )
140
+ const res = await doCompileScript ( store , descriptor , id , false , isTS , isJSX , isCE )
129
141
clientScript = res . code
130
142
bindings = res . bindings
131
143
clientScriptMap = res . map
@@ -147,6 +159,7 @@ export async function compileFile(
147
159
true ,
148
160
isTS ,
149
161
isJSX ,
162
+ isCE
150
163
)
151
164
ssrScript = ssrScriptResult . code
152
165
ssrCode += ssrScript
@@ -212,18 +225,6 @@ export async function compileFile(
212
225
}
213
226
214
227
// styles
215
- const ceFilter = store . sfcOptions . script ?. customElement || / \. c e \. v u e $ /
216
- function isCustomElement ( filters : typeof ceFilter ) : boolean {
217
- if ( typeof filters === 'boolean' ) {
218
- return filters
219
- }
220
- if ( typeof filters === 'function' ) {
221
- return filters ( filename )
222
- }
223
- return filters . test ( filename )
224
- }
225
- let isCE = isCustomElement ( ceFilter )
226
-
227
228
let css = ''
228
229
let styles : string [ ] = [ ]
229
230
for ( const style of descriptor . styles ) {
@@ -295,6 +296,7 @@ async function doCompileScript(
295
296
ssr : boolean ,
296
297
isTS : boolean ,
297
298
isJSX : boolean ,
299
+ isCustomElement : boolean ,
298
300
) : Promise < { code : string ; bindings : BindingMetadata | undefined ; map ?: any } > {
299
301
if ( descriptor . script || descriptor . scriptSetup ) {
300
302
const expressionPlugins : CompilerOptions [ 'expressionPlugins' ] = [ ]
@@ -318,6 +320,7 @@ async function doCompileScript(
318
320
expressionPlugins,
319
321
} ,
320
322
} ,
323
+ customElement : isCustomElement ,
321
324
} )
322
325
let code = compiledScript . content
323
326
if ( isTS ) {
0 commit comments