Skip to content

Commit 56ad2be

Browse files
authored
fix(utils): clone RegExp values with new RegExp instead of structuredClone (fix #19245, fix #18875) (#19247)
1 parent f2c07db commit 56ad2be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/vite/src/node/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ function deepClone<T>(value: T): DeepWritable<T> {
11221122
return value as DeepWritable<T>
11231123
}
11241124
if (value instanceof RegExp) {
1125-
return structuredClone(value) as DeepWritable<T>
1125+
return new RegExp(value) as DeepWritable<T>
11261126
}
11271127
if (typeof value === 'object' && value != null) {
11281128
throw new Error('Cannot deep clone non-plain object')

0 commit comments

Comments
 (0)