fix config resolution

master
Brad Cornes 2020-12-03 17:59:29 +00:00
parent 0bd003b082
commit 264cdc0c5e
1 changed files with 13 additions and 7 deletions

View File

@ -11,19 +11,25 @@ export default function resolveConfig({ cwd, config }) {
config = __non_webpack_require__(config)
}
let resolve = (x) => x
withUserEnvironment(cwd, ({ require, resolve }) => {
return withUserEnvironment(cwd, ({ require, resolve }) => {
let resolveConfigFn = (config) => config
const tailwindBase = path.dirname(resolve('tailwindcss/package.json'))
try {
resolve = require('./resolveConfig.js', tailwindBase)
resolveConfigFn = require('./resolveConfig.js', tailwindBase)
} catch (_) {
try {
const resolveConfig = require('./lib/util/resolveConfig.js', tailwindBase)
const defaultConfig = require('./stubs/defaultConfig.stub.js', tailwindBase)
resolve = (config) => resolveConfig([config, defaultConfig])
} catch (_) {}
resolveConfigFn = (config) => resolveConfig([config, defaultConfig])
} catch (_) {
try {
const resolveConfig = require('./lib/util/mergeConfigWithDefaults.js', tailwindBase)
.default
const defaultConfig = require('./defaultConfig.js', tailwindBase)()
resolveConfigFn = (config) => resolveConfig(config, defaultConfig)
} catch (_) {}
}
}
return resolveConfigFn(config)
})
return resolve(config)
}