File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ const debug = Debug('vite-plugin-components:transform:script')
14
14
export function VueScriptTransformer ( ctx : Context ) : Transform {
15
15
return {
16
16
test ( { path, query } ) {
17
- return ! path . startsWith ( '/@' )
18
- && path . endsWith ( '.vue' )
17
+ return path . endsWith ( '.vue' )
19
18
&& ! query . type
20
19
} ,
21
20
transform ( { code, path, isBuild } ) {
@@ -29,6 +28,9 @@ export function VueScriptTransformer(ctx: Context): Transform {
29
28
30
29
const entry = isBuild ? 'script' : '__script'
31
30
31
+ if ( ! code . includes ( `export default ${ entry } ` ) )
32
+ return code
33
+
32
34
// import a component resolver which is generated by the plugin
33
35
lines . push (
34
36
`import __components from "/${ filepath } ${ RESOLVER_EXT } "` ,
Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ const debug = Debug('vite-plugin-components:transform:script-setup')
8
8
export function VueScriptSetupTransformer ( ctx : Context ) : Transform {
9
9
return {
10
10
test ( { path, query } ) {
11
- return ! path . startsWith ( '/@' )
12
- && path . endsWith ( '.vue' )
11
+ return path . endsWith ( '.vue' )
13
12
&& query . type === 'script'
14
13
&& ( Boolean ( query . setup ) || query . setup === '' )
15
14
} ,
Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ const debug = Debug('vite-plugin-components:transform:template')
14
14
export function VueTemplateTransformer ( ctx : Context ) : Transform {
15
15
return {
16
16
test ( { path, query } ) {
17
- return ! path . startsWith ( '/@' )
18
- && path . endsWith ( '.vue' )
17
+ return path . endsWith ( '.vue' )
19
18
&& query . type === 'template'
20
19
} ,
21
20
transform ( { code, path } ) {
You can’t perform that action at this time.
0 commit comments