diff --git a/packages/qwik/src/optimizer/core/benches/transform.rs b/packages/qwik/src/optimizer/core/benches/transform.rs index c913f19cd6f..845710e9009 100644 --- a/packages/qwik/src/optimizer/core/benches/transform.rs +++ b/packages/qwik/src/optimizer/core/benches/transform.rs @@ -188,6 +188,7 @@ fn transform_todo_app(b: &mut Bencher) { input: vec![TransformModuleInput { code: code.into(), path: "file.tsx".into(), + dev_path: None, }], root_dir: None, core_module: None, diff --git a/packages/qwik/src/optimizer/core/src/transform.rs b/packages/qwik/src/optimizer/core/src/transform.rs index bdd95719a38..c2332313411 100644 --- a/packages/qwik/src/optimizer/core/src/transform.rs +++ b/packages/qwik/src/optimizer/core/src/transform.rs @@ -1787,10 +1787,15 @@ impl<'a> Fold for QwikTransform<'a> { .last_mut() .expect("Declaration stack empty!"); + let is_qcomponent = self.stack_ctxt.last() == Some(&QCOMPONENT.to_string()); + for param in &node.params { let mut identifiers = vec![]; - collect_from_pat(¶m.pat, &mut identifiers); - let is_constant = matches!(param.pat, ast::Pat::Ident(_)); + let is_identifier = collect_from_pat(¶m.pat, &mut identifiers); + let mut is_constant = false; + if is_qcomponent { + is_constant = is_identifier; + } current_scope.extend( identifiers .into_iter() @@ -1817,10 +1822,16 @@ impl<'a> Fold for QwikTransform<'a> { .decl_stack .last_mut() .expect("Declaration stack empty!"); + + let is_qcomponent = self.stack_ctxt.last() == Some(&QCOMPONENT.to_string()); + for param in &node.params { let mut identifiers = vec![]; - collect_from_pat(param, &mut identifiers); - let is_constant = matches!(param, ast::Pat::Ident(_)); + let is_identifier = collect_from_pat(param, &mut identifiers); + let mut is_constant = false; + if is_qcomponent { + is_constant = is_identifier; + } current_scope.extend( identifiers .into_iter()