File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,10 @@ export function transformSyntaxToRspackTarget(
173
173
) {
174
174
return 'es2022' ;
175
175
}
176
-
176
+ // The es6 is the same as es2015, compatible with rspack API schema
177
+ if ( normalizedSyntaxItem === 'es6' ) {
178
+ return 'es2015' ;
179
+ }
177
180
return normalizedSyntaxItem ;
178
181
}
179
182
Original file line number Diff line number Diff line change @@ -153,13 +153,20 @@ describe('transformSyntaxToBrowserslist', () => {
153
153
154
154
describe ( 'transformSyntaxToRspackTarget' , ( ) => {
155
155
test ( 'esX' , ( ) => {
156
+ const es6 = transformSyntaxToRspackTarget ( 'es6' ) ;
156
157
const es2023 = transformSyntaxToRspackTarget ( 'es2023' ) ;
157
158
const es2024 = transformSyntaxToRspackTarget ( 'es2024' ) ;
158
159
const esnext = transformSyntaxToRspackTarget ( 'esnext' ) ;
159
160
160
161
expect ( es2023 ) . toEqual ( es2024 ) ;
161
162
expect ( es2023 ) . toEqual ( esnext ) ;
162
163
164
+ expect ( es6 ) . toMatchInlineSnapshot ( `
165
+ [
166
+ "es2015",
167
+ ]
168
+ ` ) ;
169
+
163
170
expect ( es2023 ) . toMatchInlineSnapshot (
164
171
`
165
172
[
@@ -186,5 +193,14 @@ describe('transformSyntaxToRspackTarget', () => {
186
193
"es2022",
187
194
]
188
195
` ) ;
196
+
197
+ expect (
198
+ transformSyntaxToRspackTarget ( [ 'Chrome 123' , 'es6' ] ) ,
199
+ ) . toMatchInlineSnapshot ( `
200
+ [
201
+ "browserslist:Chrome 123",
202
+ "es2015",
203
+ ]
204
+ ` ) ;
189
205
} ) ;
190
206
} ) ;
You can’t perform that action at this time.
0 commit comments