fix: Add back pnpm support

master
DanSnow 2020-08-27 20:39:00 +08:00
parent e713b2bed8
commit 7ba8b4d8f8
No known key found for this signature in database
GPG Key ID: 2B25949174178EBD
3 changed files with 10 additions and 7 deletions

View File

@ -5,9 +5,10 @@ import { isObject } from './isObject'
import { withUserEnvironment } from './environment'
export async function getBuiltInPlugins({ cwd, resolvedConfig }) {
return withUserEnvironment(cwd, ({ require }) => {
return withUserEnvironment(cwd, ({ require, resolve }) => {
const tailwindBase = path.dirname(resolve('tailwindcss/package.json'))
try {
return require('tailwindcss/lib/corePlugins.js').default({
return require('./lib/corePlugins.js', tailwindBase).default({
corePlugins: resolvedConfig.corePlugins,
})
} catch (_) {

View File

@ -184,7 +184,8 @@ function loadMeta(configDir) {
let featureFlags
try {
featureFlags = require('tailwindcss/lib/featureFlags.js').default
const tailwindBase = path.dirname(resolve('tailwindcss/package.json'))
featureFlags = require('./lib/featureFlags.js', tailwindBase).default
} catch (_) {}
return { version, featureFlags }

View File

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