File tree Expand file tree Collapse file tree 4 files changed +24
-10
lines changed
Expand file tree Collapse file tree 4 files changed +24
-10
lines changed Original file line number Diff line number Diff line change 108108 "pkg-up" : " ^3.1.0" ,
109109 "postcss" : " ^7.0.27" ,
110110 "postcss-selector-parser" : " ^6.0.2" ,
111+ "resolve-from" : " ^5.0.0" ,
111112 "rimraf" : " ^3.0.2" ,
112113 "semver" : " ^7.3.2" ,
113114 "stack-trace" : " 0.0.10" ,
Original file line number Diff line number Diff line change @@ -2,12 +2,17 @@ import * as path from 'path'
22import stackTrace from 'stack-trace'
33import pkgUp from 'pkg-up'
44import { isObject } from './isObject'
5+ import resolveFrom from 'resolve-from'
56import importFrom from 'import-from'
67
78export async function getBuiltInPlugins ( { cwd, resolvedConfig } ) {
9+ const tailwindBase = path . dirname (
10+ resolveFrom ( cwd , 'tailwindcss/package.json' )
11+ )
12+
813 try {
914 // TODO: add v0 support ("generators")
10- return importFrom ( cwd , 'tailwindcss /lib/corePlugins.js' ) . default ( {
15+ return importFrom ( tailwindBase , '. /lib/corePlugins.js' ) . default ( {
1116 corePlugins : resolvedConfig . corePlugins ,
1217 } )
1318 } catch ( _ ) {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import extractClassNames from './extractClassNames'
22import Hook from './hook'
33import dlv from 'dlv'
44import dset from 'dset'
5+ import resolveFrom from 'resolve-from'
56import importFrom from 'import-from'
67import chokidar from 'chokidar'
78import semver from 'semver'
@@ -55,13 +56,16 @@ export default async function getClassNames(
5556 invariant ( configPath . length === 1 , 'No Tailwind CSS config found.' )
5657 configPath = configPath [ 0 ]
5758 const configDir = path . dirname ( configPath )
58- postcss = importFrom ( configDir , 'postcss' )
59+ const tailwindBase = path . dirname (
60+ resolveFrom ( configDir , 'tailwindcss/package.json' )
61+ )
62+ postcss = importFrom ( tailwindBase , 'postcss' )
5963 tailwindcss = importFrom ( configDir , 'tailwindcss' )
6064 version = importFrom ( configDir , 'tailwindcss/package.json' ) . version
6165
6266 try {
6367 // this is not required
64- browserslistModule = importFrom ( configDir , 'browserslist' )
68+ browserslistModule = importFrom ( tailwindBase , 'browserslist' )
6569 } catch ( _ ) { }
6670
6771 const sepLocation = semver . gte ( version , '0.99.0' )
Original file line number Diff line number Diff line change 1+ import resolveFrom from 'resolve-from'
12import importFrom from 'import-from'
23import * as path from 'path'
34import decache from './decache'
45
56export default function resolveConfig ( { cwd, config } ) {
6- let resolve = x => x
7+ const tailwindBase = path . dirname (
8+ resolveFrom ( cwd , 'tailwindcss/package.json' )
9+ )
10+ let resolve = ( x ) => x
711
812 if ( typeof config === 'string' ) {
913 if ( ! cwd ) {
@@ -14,18 +18,18 @@ export default function resolveConfig({ cwd, config }) {
1418 }
1519
1620 try {
17- resolve = importFrom ( cwd , 'tailwindcss /resolveConfig.js' )
21+ resolve = importFrom ( tailwindBase , '. /resolveConfig.js' )
1822 } catch ( _ ) {
1923 try {
2024 const resolveConfig = importFrom (
21- cwd ,
22- 'tailwindcss /lib/util/resolveConfig.js'
25+ tailwindBase ,
26+ '. /lib/util/resolveConfig.js'
2327 )
2428 const defaultConfig = importFrom (
25- cwd ,
26- 'tailwindcss /stubs/defaultConfig.stub.js'
29+ tailwindBase ,
30+ '. /stubs/defaultConfig.stub.js'
2731 )
28- resolve = config => resolveConfig ( [ config , defaultConfig ] )
32+ resolve = ( config ) => resolveConfig ( [ config , defaultConfig ] )
2933 } catch ( _ ) { }
3034 }
3135
You can’t perform that action at this time.
0 commit comments