Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Always sort candidates
  • Loading branch information
adamwathan committed Jan 21, 2023
commit ef2a887020fca3e5a166f0c581dd2c40d4f4c8d9
20 changes: 8 additions & 12 deletions src/lib/expandTailwindAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,15 @@ export default function expandTailwindAtRules(context) {
let classCacheCount = context.classCache.size

env.DEBUG && console.time('Generate rules')
// TODO: Sorting is _probably_ slow, but right now it can guarantee the same order. Eventually
// we will be able to get rid of this.
// TODO: This has a small cost but is needed to make builds deterministic. Move this to Rust eventually.
env.DEBUG && console.time('Sorting candidates')
let sortedCandidates =
typeof process !== 'undefined' && process.env.JEST_WORKER_ID
? new Set(
[...candidates].sort((a, z) => {
if (a === z) return 0
if (a < z) return -1
return 1
})
)
: candidates
let sortedCandidates = new Set(
[...candidates].sort((a, z) => {
if (a === z) return 0
if (a < z) return -1
return 1
})
)
env.DEBUG && console.timeEnd('Sorting candidates')
generateRules(sortedCandidates, context)
env.DEBUG && console.timeEnd('Generate rules')
Expand Down