Skip to content

Commit

Permalink
Use strip_with_jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Oct 18, 2021
1 parent e87c4cb commit c564646
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions packages/transformers/js/core/src/lib.rs
Expand Up @@ -255,16 +255,6 @@ pub fn transform(config: Config) -> Result<TransformResult, std::io::Error> {
let ignore_mark = Mark::fresh(Mark::root());
module = {
let mut passes = chain!(
resolver_with_mark(global_mark),
Optional::new(
react::react(
source_map.clone(),
Some(&comments),
react_options,
global_mark
),
config.is_jsx
),
// Decorators can use type information, so must run before the TypeScript pass.
Optional::new(
decorators::decorators(decorators::Config {
Expand All @@ -274,9 +264,30 @@ pub fn transform(config: Config) -> Result<TransformResult, std::io::Error> {
}),
config.decorators
),
Optional::new(typescript::strip(), config.is_type_script),
// Run resolver again. TS pass messes things up.
Optional::new(
typescript::strip_with_jsx(
source_map.clone(),
typescript::Config {
pragma: Some(react_options.pragma.clone()),
pragma_frag: Some(react_options.pragma_frag.clone()),
..Default::default()
},
Some(&comments),
global_mark,
),
config.is_type_script && config.is_jsx
),
Optional::new(typescript::strip(), config.is_type_script && !config.is_jsx),
resolver_with_mark(global_mark),
Optional::new(
react::react(
source_map.clone(),
Some(&comments),
react_options,
global_mark
),
config.is_jsx
),
);

module.fold_with(&mut passes)
Expand Down

0 comments on commit c564646

Please sign in to comment.