diff --git a/src/server.ts b/src/server.ts index 1651cbee9003fdfc0718343923adc92cbf9c0042..5f14ebdd030e6bed65ae25361c2df3a9b0078887 100644 --- a/src/server.ts +++ b/src/server.ts @@ -536,7 +536,6 @@ let userSeperator: string let userPurge let userVariants: any let userMode: any - let userPlugins: any let hook = new Hook(fs.realpathSync(state.configPath), (exports) => { userSeperator = dlv(exports, sepLocation) if (typeof userSeperator !== 'string') { @@ -561,33 +560,25 @@ } // inject JIT `matchUtilities` function if (Array.isArray(exports.plugins)) { - userPlugins = exports.plugins - exports.plugins = exports.plugins.map((plugin) => { + for (let index in exports.plugins) { + let plugin = exports.plugins[index] if (typeof plugin === 'function') { - let newPlugin = (...args) => { + exports.plugins[index] = (...args) => { if (!args[0].matchUtilities) { args[0].matchUtilities = () => {} } return plugin(...args) } - // @ts-ignore - newPlugin.__intellisense_cache_bust = Math.random() - return newPlugin - } - if (plugin.handler) { - return { - ...plugin, - handler: (...args) => { - if (!args[0].matchUtilities) { - args[0].matchUtilities = () => {} - } - return plugin.handler(...args) - }, - __intellisense_cache_bust: Math.random(), + } else if (plugin.handler) { + let oldHandler = plugin.handler + plugin.handler = (...args) => { + if (!args[0].matchUtilities) { + args[0].matchUtilities = () => {} + } + return oldHandler(...args) } } - return plugin - }) + } } return exports @@ -648,9 +639,6 @@ delete config.variants } if (typeof userMode !== 'undefined') { config.mode = userMode - } - if (typeof userPlugins !== 'undefined') { - config.plugins = userPlugins } if (state.dependencies) {