diff --git a/src/class-names/index.js b/src/class-names/index.js index c456d5bdd640dc47f80cbcc4fa49cde3697d206f..83a15b11a214b931a6e04f569b3d5da5295eda55 100644 --- a/src/class-names/index.js +++ b/src/class-names/index.js @@ -17,6 +17,17 @@ import { getUtilityConfigMap } from './getUtilityConfigMap' import glob from 'fast-glob' import normalizePath from 'normalize-path' +function TailwindConfigError(error) { + Error.call(this) + Error.captureStackTrace(this, this.constructor) + + this.name = this.constructor.name + this.message = error.message + this.stack = error.stack +} + +util.inherits(TailwindConfigError, Error) + function arraysEqual(arr1, arr2) { return ( JSON.stringify(arr1.concat([]).sort()) === @@ -87,47 +98,38 @@ let config try { config = __non_webpack_require__(configPath) } catch (error) { +import { getUtilityConfigMap } from './getUtilityConfigMap' import chokidar from 'chokidar' -import semver from 'semver' - hook.unhook() - throw error } - hook.unwatch() - let postcssResult import extractClassNames from './extractClassNames' -import invariant from 'tiny-invariant' - try { - postcssResult = await Promise.all( - [ -import semver from 'semver' import importFrom from 'import-from' import semver from 'semver' -import chokidar from 'chokidar' - 'utilities', -import semver from 'semver' +import { getUtilityConfigMap } from './getUtilityConfigMap' import invariant from 'tiny-invariant' -import invariant from 'tiny-invariant' +import glob from 'fast-glob' -import invariant from 'tiny-invariant' +import glob from 'fast-glob' import extractClassNames from './extractClassNames' -import invariant from 'tiny-invariant' +import glob from 'fast-glob' import Hook from './hook' -import invariant from 'tiny-invariant' +import glob from 'fast-glob' import dlv from 'dlv' -import invariant from 'tiny-invariant' +import glob from 'fast-glob' import dset from 'dset' +import extractClassNames from './extractClassNames' import chokidar from 'chokidar' -import chokidar from 'chokidar' +import resolveFrom from 'resolve-from' +import getPlugins from './getPlugins' import semver from 'semver' import invariant from 'tiny-invariant' +import dset from 'dset' +import dset from 'dset' import resolveFrom from 'resolve-from' - hook.unhook() -import semver from 'semver' import extractClassNames from './extractClassNames' +import invariant from 'tiny-invariant' import extractClassNames from './extractClassNames' -import invariant from 'tiny-invariant' -import invariant from 'tiny-invariant' +import chokidar from 'chokidar' import importFrom from 'import-from' if (typeof userSeperator !== 'undefined') { @@ -193,8 +197,14 @@ try { result = await run() } catch (error) { import extractClassNames from './extractClassNames' -import dset from 'dset' + } catch (error) { + onChange({ error }) +import extractClassNames from './extractClassNames' import chokidar from 'chokidar' +import invariant from 'tiny-invariant' + unwatch() + onChange(null) + } return } const newDeps = [result.configPath, ...result.dependencies]