Skip to content

Commit

Permalink
fix(compiler): resolve virtual vuestic-config
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed Jul 17, 2024
1 parent d199521 commit fa44f00
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/compiler/vuestic-config/plugins/config-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { readFile } from 'node:fs/promises'
const VUESTIC_CONFIG_ALIAS = '#vuestic-config'

export const resolveVuesticConfigPath = () => {
if (existsSync('vuestic.config.ts')) {
if (existsSync('./vuestic.config.ts')) {
return './vuestic.config.ts'
} else if (existsSync('vuestic.config.js')) {
} else if (existsSync('./vuestic.config.js')) {
return './vuestic.config.js'
} else if (existsSync('vuestic.config.mjs')) {
} else if (existsSync('./vuestic.config.mjs')) {
return './vuestic.config.mjs'
} else if (existsSync('vuestic.config.cjs')) {
} else if (existsSync('./vuestic.config.cjs')) {
return './vuestic.config.cjs'
} else if (existsSync('vuestic.config.mts')) {
} else if (existsSync('./vuestic.config.mts')) {
return './vuestic.config.mts'
} else {
return undefined
Expand All @@ -29,11 +29,11 @@ export const tryToReadConfig = async (path: string) => {
}

export const isConfigExists = (configPath: string | undefined) => {
const path = configPath ?? resolveVuesticConfigPath()

if (!path) { return false}
if (!configPath) {
return resolveVuesticConfigPath()
}

return existsSync(path)
return existsSync(configPath)
}

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

Expand All @@ -56,7 +56,7 @@ export const configResolver = (options: {
configPath = resolveVuesticConfigPath()
} = options

if (id === `virtual:${VUESTIC_CONFIG_ALIAS}`) {
if (id === `virtual:vuestic-config`) {
if (!configPath) {
return 'export default {}'
}
Expand Down

0 comments on commit fa44f00

Please sign in to comment.