Skip to content

Commit

Permalink
Add(Techor): buildOptions for readConfig() arg2
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Mar 31, 2023
1 parent 29f6a91 commit 5579103
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/techor/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import defaultOptions, { Options as TechorOptions } from './options'
import fg from 'fast-glob'
import crossImport from 'cross-import'
import extend from '@techor/extend'
import type { BuildOptions } from 'esbuild'

export default class Techor<Options extends TechorOptions<Config>, Config> {
options: Options
Expand All @@ -17,7 +18,7 @@ export default class Techor<Options extends TechorOptions<Config>, Config> {
logConfigFound = (configPath: string) => log.ok`**${configPath}** config file found`
logConfigNotFound = (configPath: string) => log.i`No **${configPath}** config file found`

readConfig(key = 'config'): Config | any {
readConfig(key = 'config', buildOptions?: BuildOptions): Config | any {
const { config, cwd } = this.options
if (typeof config === 'object') {
return config as Config
Expand All @@ -26,7 +27,7 @@ export default class Techor<Options extends TechorOptions<Config>, Config> {
try {
const configPath = this.configPath
if (configPath) {
const userConfigModule = crossImport(configPath, { cwd })
const userConfigModule = crossImport(configPath, { cwd }, buildOptions as any)
userConfig = (key ? userConfigModule[key] : undefined) || userConfigModule.default || userConfigModule
this.logConfigFound(configPath)
} else {
Expand Down

0 comments on commit 5579103

Please sign in to comment.