Skip to content

Commit

Permalink
fix(utils): clone RegExp values with new RegExp instead of `struc…
Browse files Browse the repository at this point in the history
…turedClone` (fix #19245, fix #18875) (#19247)
  • Loading branch information
askoufis authored Jan 24, 2025
1 parent f2c07db commit 56ad2be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ function deepClone<T>(value: T): DeepWritable<T> {
return value as DeepWritable<T>
}
if (value instanceof RegExp) {
return structuredClone(value) as DeepWritable<T>
return new RegExp(value) as DeepWritable<T>
}
if (typeof value === 'object' && value != null) {
throw new Error('Cannot deep clone non-plain object')
Expand Down

0 comments on commit 56ad2be

Please sign in to comment.