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(
173173 ) {
174174 return 'es2022' ;
175175 }
176-
176+ // The es6 is the same as es2015, compatible with rspack API schema
177+ if ( normalizedSyntaxItem === 'es6' ) {
178+ return 'es2015' ;
179+ }
177180 return normalizedSyntaxItem ;
178181 }
179182
Original file line number Diff line number Diff line change @@ -153,13 +153,20 @@ describe('transformSyntaxToBrowserslist', () => {
153153
154154describe ( 'transformSyntaxToRspackTarget' , ( ) => {
155155 test ( 'esX' , ( ) => {
156+ const es6 = transformSyntaxToRspackTarget ( 'es6' ) ;
156157 const es2023 = transformSyntaxToRspackTarget ( 'es2023' ) ;
157158 const es2024 = transformSyntaxToRspackTarget ( 'es2024' ) ;
158159 const esnext = transformSyntaxToRspackTarget ( 'esnext' ) ;
159160
160161 expect ( es2023 ) . toEqual ( es2024 ) ;
161162 expect ( es2023 ) . toEqual ( esnext ) ;
162163
164+ expect ( es6 ) . toMatchInlineSnapshot ( `
165+ [
166+ "es2015",
167+ ]
168+ ` ) ;
169+
163170 expect ( es2023 ) . toMatchInlineSnapshot (
164171 `
165172 [
@@ -186,5 +193,14 @@ describe('transformSyntaxToRspackTarget', () => {
186193 "es2022",
187194 ]
188195 ` ) ;
196+
197+ expect (
198+ transformSyntaxToRspackTarget ( [ 'Chrome 123' , 'es6' ] ) ,
199+ ) . toMatchInlineSnapshot ( `
200+ [
201+ "browserslist:Chrome 123",
202+ "es2015",
203+ ]
204+ ` ) ;
189205 } ) ;
190206} ) ;
You can’t perform that action at this time.
0 commit comments