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) config = __non_webpack_require__(config)
} }
let resolve = (x) => x return withUserEnvironment(cwd, ({ require, resolve }) => {
withUserEnvironment(cwd, ({ require, resolve }) => { let resolveConfigFn = (config) => config
const tailwindBase = path.dirname(resolve('tailwindcss/package.json')) const tailwindBase = path.dirname(resolve('tailwindcss/package.json'))
try { try {
resolve = require('./resolveConfig.js', tailwindBase) resolveConfigFn = require('./resolveConfig.js', tailwindBase)
} catch (_) { } catch (_) {
try { try {
const resolveConfig = require('./lib/util/resolveConfig.js', tailwindBase) const resolveConfig = require('./lib/util/resolveConfig.js', tailwindBase)
const defaultConfig = require('./stubs/defaultConfig.stub.js', tailwindBase) const defaultConfig = require('./stubs/defaultConfig.stub.js', tailwindBase)
resolve = (config) => resolveConfig([config, defaultConfig]) 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 (_) {} } catch (_) {}
} }
}) }
return resolveConfigFn(config)
return resolve(config) })
} }