@@ -17,17 +17,6 @@ import { getUtilityConfigMap } from './getUtilityConfigMap'
1717import glob from 'fast-glob'
1818import normalizePath from 'normalize-path'
1919
20- function TailwindConfigError ( error ) {
21- Error . call ( this )
22- Error . captureStackTrace ( this , this . constructor )
23-
24- this . name = this . constructor . name
25- this . message = error . message
26- this . stack = error . stack
27- }
28-
29- util . inherits ( TailwindConfigError , Error )
30-
3120function arraysEqual ( arr1 , arr2 ) {
3221 return (
3322 JSON . stringify ( arr1 . concat ( [ ] ) . sort ( ) ) ===
@@ -98,23 +87,34 @@ export default async function getClassNames(
9887 try {
9988 config = __non_webpack_require__ ( configPath )
10089 } catch ( error ) {
101- throw new TailwindConfigError ( error )
90+ hook . unwatch ( )
91+ hook . unhook ( )
92+ throw error
10293 }
94+
10395 hook . unwatch ( )
10496
105- const [ base , components , utilities ] = await Promise . all (
106- [
107- semver . gte ( version , '0.99.0' ) ? 'base' : 'preflight' ,
108- 'components' ,
109- 'utilities' ,
110- ] . map ( ( group ) =>
111- postcss ( [ tailwindcss ( configPath ) ] ) . process ( `@tailwind ${ group } ;` , {
112- from : undefined ,
113- } )
97+ let postcssResult
98+
99+ try {
100+ postcssResult = await Promise . all (
101+ [
102+ semver . gte ( version , '0.99.0' ) ? 'base' : 'preflight' ,
103+ 'components' ,
104+ 'utilities' ,
105+ ] . map ( ( group ) =>
106+ postcss ( [ tailwindcss ( configPath ) ] ) . process ( `@tailwind ${ group } ;` , {
107+ from : undefined ,
108+ } )
109+ )
114110 )
115- )
111+ } catch ( error ) {
112+ throw error
113+ } finally {
114+ hook . unhook ( )
115+ }
116116
117- hook . unhook ( )
117+ const [ base , components , utilities ] = postcssResult
118118
119119 if ( typeof userSeperator !== 'undefined' ) {
120120 dset ( config , sepLocation , userSeperator )
@@ -180,12 +180,7 @@ export default async function getClassNames(
180180 try {
181181 result = await run ( )
182182 } catch ( error ) {
183- if ( error instanceof TailwindConfigError ) {
184- onChange ( { error } )
185- } else {
186- unwatch ( )
187- onChange ( null )
188- }
183+ onChange ( { error } )
189184 return
190185 }
191186 const newDeps = [ result . configPath , ...result . dependencies ]
0 commit comments