diff --git a/src/index.js b/src/index.js index e516e9a31..a954dc458 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,7 @@ import resolveConfig from './util/resolveConfig' import getAllConfigs from './util/getAllConfigs' import { supportedConfigFiles } from './constants' import defaultConfig from '../stubs/defaultConfig.stub.js' +import log from './util/log' function resolveConfigPath(filePath) { // require('tailwindcss')({ theme: ..., variants: ... }) @@ -65,8 +66,19 @@ const getConfigFunction = (config) => () => { } module.exports = function (config) { - const plugins = [] const resolvedConfigPath = resolveConfigPath(config) + const getConfig = getConfigFunction(resolvedConfigPath || config) + const mode = _.get(getConfig(), 'mode', 'aot') + + if (mode === 'jit') { + log.warn([ + `You have enabled the JIT engine which is currently in preview.`, + 'Preview features are not covered by semver, may introduce breaking changes, and can change at any time.', + ]) + return require('../jit/index.js')(config) + } + + const plugins = [] if (!_.isUndefined(resolvedConfigPath)) { plugins.push(registerConfigAsDependency(resolvedConfigPath)) @@ -74,11 +86,7 @@ module.exports = function (config) { return { postcssPlugin: 'tailwindcss', - plugins: [ - ...plugins, - processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)), - formatCSS, - ], + plugins: [...plugins, processTailwindFeatures(getConfig), formatCSS], } }