Skip to content

Commit beeffb2

Browse files
committed
fix(cjs): update version check for require ESM support
1 parent 0a63a60 commit beeffb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/features/cjs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export function warnLegacyCJS(config: ResolvedConfig): void {
1212
return
1313
}
1414

15-
const legacy = config.target.some((t) => {
15+
const supportRequireESM = config.target.some((t) => {
1616
const version = coerce(t.split('node')[1])
17-
return version && satisfies(version, '>=23.0.0 || >=22.12.0')
17+
return version && satisfies(version, '^20.19.0 || >=22.12.0')
1818
})
1919

20-
if (legacy) {
20+
if (supportRequireESM) {
2121
config.logger.warnOnce(
2222
'We recommend using the ESM format instead of CommonJS.\n' +
2323
'The ESM format is compatible with modern platforms and runtimes, ' +

0 commit comments

Comments
 (0)