diff --git a/crates/swc/tests/fixture/issues-8xxx/8528/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8528/input/.swcrc new file mode 100644 index 000000000000..3b01d7ddcd9e --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8528/input/.swcrc @@ -0,0 +1,26 @@ +{ + "jsc": { + "parser": { + "decorators": true, + "syntax": "typescript" + }, + "transform": { + "decoratorVersion": "2022-03" + }, + "externalHelpers": true, + "experimental": { + "plugins": [ + [ + "@swc/plugin-styled-components", + { + "displayName": true, + "ssr": true + } + ] + ] + } + }, + "env": { + "targets": "> 1%, not dead" + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8528/input/index.tsx b/crates/swc/tests/fixture/issues-8xxx/8528/input/index.tsx new file mode 100644 index 000000000000..71749d2ea4d6 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8528/input/index.tsx @@ -0,0 +1,10 @@ +import { observer } from "mobx"; +import * as React from "react"; +import * as S from "./BetButton.styled"; + +@observer +class BetButtonWrapper extends React.Component { + render() { + return ; + } +} diff --git a/crates/swc/tests/fixture/issues-8xxx/8528/output/index.tsx b/crates/swc/tests/fixture/issues-8xxx/8528/output/index.tsx new file mode 100644 index 000000000000..fb930b639d8f --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8528/output/index.tsx @@ -0,0 +1,15 @@ +import { _ as _apply_decs_2203_r } from "@swc/helpers/_/_apply_decs_2203_r"; +var _initClass, _React_Component; +import { observer } from "mobx"; +import * as React from "react"; +import * as S from "./BetButton.styled"; +let _BetButtonWrapper; +class BetButtonWrapper extends (_React_Component = React.Component) { + static #_ = { c: [_BetButtonWrapper, _initClass] } = _apply_decs_2203_r(this, [], [ + observer + ], _React_Component); + render() { + return /*#__PURE__*/ React.createElement(S.BetButtonWrapper, null); + } + static #_2 = _initClass(); +} diff --git a/crates/swc_ecma_transforms_base/tests/resolver/issue-8528/input.js b/crates/swc_ecma_transforms_base/tests/resolver/issue-8528/input.js new file mode 100644 index 000000000000..a231c8fc4d1a --- /dev/null +++ b/crates/swc_ecma_transforms_base/tests/resolver/issue-8528/input.js @@ -0,0 +1,4 @@ +let A; + +B.A; +; diff --git a/crates/swc_ecma_transforms_base/tests/resolver/issue-8528/output.js b/crates/swc_ecma_transforms_base/tests/resolver/issue-8528/output.js new file mode 100644 index 000000000000..b8a00b4744ac --- /dev/null +++ b/crates/swc_ecma_transforms_base/tests/resolver/issue-8528/output.js @@ -0,0 +1,3 @@ +let A__2; +B.A; +; diff --git a/crates/swc_ecma_visit/src/lib.rs b/crates/swc_ecma_visit/src/lib.rs index ae4b604985fd..487c7060d8c1 100644 --- a/crates/swc_ecma_visit/src/lib.rs +++ b/crates/swc_ecma_visit/src/lib.rs @@ -1927,6 +1927,10 @@ macro_rules! visit_mut_obj_and_computed { } } + fn visit_mut_jsx_member_expr(&mut self, n: &mut $crate::swc_ecma_ast::JSXMemberExpr) { + n.obj.visit_mut_with(self); + } + fn visit_mut_super_prop_expr(&mut self, n: &mut $crate::swc_ecma_ast::SuperPropExpr) { if let $crate::swc_ecma_ast::SuperProp::Computed(c) = &mut n.prop { c.visit_mut_with(self);