mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(transformer): fix position of inserted react import statement (#1082)
This commit is contained in:
parent
0856111bea
commit
fe4a5ed535
2 changed files with 3 additions and 5 deletions
|
|
@ -95,7 +95,7 @@ impl<'a> ReactJsx<'a> {
|
|||
let imports = self.ast.move_statement_vec(&mut self.imports);
|
||||
let index = stmts
|
||||
.iter()
|
||||
.position(|stmt| matches!(stmt, Statement::ModuleDeclaration(m) if m.is_import()))
|
||||
.rposition(|stmt| matches!(stmt, Statement::ModuleDeclaration(m) if m.is_import()))
|
||||
.map_or(0, |i| i + 1);
|
||||
stmts.splice(index..index, imports);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Passed: 224/1083
|
||||
Passed: 226/1083
|
||||
|
||||
# All Passed:
|
||||
* babel-plugin-transform-numeric-separator
|
||||
|
|
@ -804,9 +804,7 @@ Passed: 224/1083
|
|||
* regression/11061/input.mjs
|
||||
* variable-declaration/non-null-in-optional-chain/input.ts
|
||||
|
||||
# babel-plugin-transform-react-jsx (75/172)
|
||||
* autoImport/after-polyfills/input.mjs
|
||||
* autoImport/after-polyfills-2/input.mjs
|
||||
# babel-plugin-transform-react-jsx (77/172)
|
||||
* autoImport/after-polyfills-compiled-to-cjs/input.mjs
|
||||
* autoImport/after-polyfills-script-not-supported/input.js
|
||||
* autoImport/auto-import-react-source-type-module/input.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue