mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Fix @tailwindcss/line-clamp warning (#10919)
* WIP * Move warning to validateConfig This only happens in setupTrackingContext outside of resolveConfig * Use original dynamic require approach in `validateConfig` The important thing is that this happens in Node-land only. It is outside of `resolveConfig` which is public and importable into user projects. That is the scenario that breaks because of static import hoisting. * Don’t reference process when it might be undefined The `resolveConfig` dep path is public which should not reference process. However, we have some behavior that changes based on env vars so we need to conditionalize it instead. * Update changelog * Formatting * More formatting * Update changelog --------- Co-authored-by: Robin Malfait <malfait.robin@gmail.com> Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
This commit is contained in:
parent
9cd0301b0a
commit
474178055e
@ -12,7 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Try resolving `config.default` before `config` to ensure the config file is resolved correctly ([#10898](https://github.com/tailwindlabs/tailwindcss/pull/10898))
|
||||
- Pull pseudo elements outside of `:is` and `:has` when using `@apply` ([#10903](https://github.com/tailwindlabs/tailwindcss/pull/10903))
|
||||
- Update the types for the `safelist` config ([#10901](https://github.com/tailwindlabs/tailwindcss/pull/10901))
|
||||
- Drop `@tailwindcss/line-clamp` warning ([#10915](https://github.com/tailwindlabs/tailwindcss/pull/10915))
|
||||
- Fix `@tailwindcss/line-clamp` warning ([#10915](https://github.com/tailwindlabs/tailwindcss/pull/10915), [#10919](https://github.com/tailwindlabs/tailwindcss/pull/10919))
|
||||
- Fix `process` is not defined error ([#10919](https://github.com/tailwindlabs/tailwindcss/pull/10919))
|
||||
|
||||
## [3.3.0] - 2023-03-27
|
||||
|
||||
|
||||
@ -1,12 +1,21 @@
|
||||
import pkg from '../../package.json'
|
||||
let OXIDE_DEFAULT_ENABLED = pkg.tailwindcss.engine === 'oxide'
|
||||
|
||||
export const env = {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
DEBUG: resolveDebug(process.env.DEBUG),
|
||||
ENGINE: pkg.tailwindcss.engine,
|
||||
OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED),
|
||||
}
|
||||
export const env =
|
||||
typeof process !== 'undefined'
|
||||
? {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
DEBUG: resolveDebug(process.env.DEBUG),
|
||||
ENGINE: pkg.tailwindcss.engine,
|
||||
OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED),
|
||||
}
|
||||
: {
|
||||
NODE_ENV: 'production',
|
||||
DEBUG: false,
|
||||
ENGINE: pkg.tailwindcss.engine,
|
||||
OXIDE: OXIDE_DEFAULT_ENABLED,
|
||||
}
|
||||
|
||||
export const contextMap = new Map()
|
||||
export const configContextMap = new Map()
|
||||
export const contextSourcesMap = new Map()
|
||||
|
||||
@ -9,5 +9,18 @@ export function validateConfig(config) {
|
||||
])
|
||||
}
|
||||
|
||||
// Warn if the line-clamp plugin is installed
|
||||
try {
|
||||
let plugin = require('@tailwindcss/line-clamp')
|
||||
if (config.plugins.includes(plugin)) {
|
||||
log.warn('line-clamp-in-core', [
|
||||
'As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.',
|
||||
'Remove it from the `plugins` array in your configuration to eliminate this warning.',
|
||||
])
|
||||
|
||||
config.plugins = config.plugins.filter((p) => p !== plugin)
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user