@@ -17,17 +17,6 @@ import { getUtilityConfigMap } from './getUtilityConfigMap'
17
17
import glob from 'fast-glob'
18
18
import normalizePath from 'normalize-path'
19
19
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
-
31
20
function arraysEqual ( arr1 , arr2 ) {
32
21
return (
33
22
JSON . stringify ( arr1 . concat ( [ ] ) . sort ( ) ) ===
@@ -98,23 +87,34 @@ export default async function getClassNames(
98
87
try {
99
88
config = __non_webpack_require__ ( configPath )
100
89
} catch ( error ) {
101
- throw new TailwindConfigError ( error )
90
+ hook . unwatch ( )
91
+ hook . unhook ( )
92
+ throw error
102
93
}
94
+
103
95
hook . unwatch ( )
104
96
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
+ )
114
110
)
115
- )
111
+ } catch ( error ) {
112
+ throw error
113
+ } finally {
114
+ hook . unhook ( )
115
+ }
116
116
117
- hook . unhook ( )
117
+ const [ base , components , utilities ] = postcssResult
118
118
119
119
if ( typeof userSeperator !== 'undefined' ) {
120
120
dset ( config , sepLocation , userSeperator )
@@ -180,12 +180,7 @@ export default async function getClassNames(
180
180
try {
181
181
result = await run ( )
182
182
} catch ( error ) {
183
- if ( error instanceof TailwindConfigError ) {
184
- onChange ( { error } )
185
- } else {
186
- unwatch ( )
187
- onChange ( null )
188
- }
183
+ onChange ( { error } )
189
184
return
190
185
}
191
186
const newDeps = [ result . configPath , ...result . dependencies ]
0 commit comments