Skip to content

Commit 6c6204f

Browse files
committed
fix: revert changes
1 parent d76af2d commit 6c6204f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/transforms/vueScript.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ const debug = Debug('vite-plugin-components:transform:script')
1414
export function VueScriptTransformer(ctx: Context): Transform {
1515
return {
1616
test({ path, query }) {
17-
return !path.startsWith('/@')
18-
&& path.endsWith('.vue')
17+
return path.endsWith('.vue')
1918
&& !query.type
2019
},
2120
transform({ code, path, isBuild }) {
@@ -29,6 +28,9 @@ export function VueScriptTransformer(ctx: Context): Transform {
2928

3029
const entry = isBuild ? 'script' : '__script'
3130

31+
if (!code.includes(`export default ${entry}`))
32+
return code
33+
3234
// import a component resolver which is generated by the plugin
3335
lines.push(
3436
`import __components from "/${filepath}${RESOLVER_EXT}"`,

src/transforms/vueScriptSetup.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const debug = Debug('vite-plugin-components:transform:script-setup')
88
export function VueScriptSetupTransformer(ctx: Context): Transform {
99
return {
1010
test({ path, query }) {
11-
return !path.startsWith('/@')
12-
&& path.endsWith('.vue')
11+
return path.endsWith('.vue')
1312
&& query.type === 'script'
1413
&& (Boolean(query.setup) || query.setup === '')
1514
},

src/transforms/vueTemplate.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ const debug = Debug('vite-plugin-components:transform:template')
1414
export function VueTemplateTransformer(ctx: Context): Transform {
1515
return {
1616
test({ path, query }) {
17-
return !path.startsWith('/@')
18-
&& path.endsWith('.vue')
17+
return path.endsWith('.vue')
1918
&& query.type === 'template'
2019
},
2120
transform({ code, path }) {

0 commit comments

Comments
 (0)