Skip to content

Commit 2f170b1

Browse files
committed
fix(compiler): resolve virtual vuestic-config
1 parent a90bfcb commit 2f170b1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/compiler/vuestic-config/plugins/config-resolver.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { readFile } from 'node:fs/promises'
55
const VUESTIC_CONFIG_ALIAS = '#vuestic-config'
66

77
export const resolveVuesticConfigPath = () => {
8-
if (existsSync('vuestic.config.ts')) {
8+
if (existsSync('./vuestic.config.ts')) {
99
return './vuestic.config.ts'
10-
} else if (existsSync('vuestic.config.js')) {
10+
} else if (existsSync('./vuestic.config.js')) {
1111
return './vuestic.config.js'
12-
} else if (existsSync('vuestic.config.mjs')) {
12+
} else if (existsSync('./vuestic.config.mjs')) {
1313
return './vuestic.config.mjs'
14-
} else if (existsSync('vuestic.config.cjs')) {
14+
} else if (existsSync('./vuestic.config.cjs')) {
1515
return './vuestic.config.cjs'
16-
} else if (existsSync('vuestic.config.mts')) {
16+
} else if (existsSync('./vuestic.config.mts')) {
1717
return './vuestic.config.mts'
1818
} else {
1919
return undefined
@@ -29,11 +29,11 @@ export const tryToReadConfig = async (path: string) => {
2929
}
3030

3131
export const isConfigExists = (configPath: string | undefined) => {
32-
const path = configPath ?? resolveVuesticConfigPath()
33-
34-
if (!path) { return false}
32+
if (!configPath) {
33+
return resolveVuesticConfigPath()
34+
}
3535

36-
return existsSync(path)
36+
return existsSync(configPath)
3737
}
3838

3939
/** This plugin is used to resolve path to vuestic config if it is imported with `#vuestic-config` */
@@ -47,7 +47,7 @@ export const configResolver = (options: {
4747
// Resolve vuestic config alias
4848
async resolveId(source) {
4949
if (source === VUESTIC_CONFIG_ALIAS) {
50-
return `virtual:${VUESTIC_CONFIG_ALIAS}`
50+
return `virtual:vuestic-config`
5151
}
5252
},
5353

@@ -56,7 +56,7 @@ export const configResolver = (options: {
5656
configPath = resolveVuesticConfigPath()
5757
} = options
5858

59-
if (id === `virtual:${VUESTIC_CONFIG_ALIAS}`) {
59+
if (id === `virtual:vuestic-config`) {
6060
if (!configPath) {
6161
return 'export default {}'
6262
}

0 commit comments

Comments
 (0)