File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
packages/parcel-transformer/src Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @compiled/parcel-transformer ' : patch
3+ ---
4+
5+ Check for missing AST in @compiled/parcel-transformer
Original file line number Diff line number Diff line change @@ -108,17 +108,21 @@ export default new Transformer<ParcelTransformerOpts>({
108108 plugins : config . transformerBabelPlugins ?? undefined ,
109109 } ) ;
110110
111- return {
112- type : 'babel' ,
113- version : '7.0.0' ,
114- program,
115- } ;
111+ if ( program ) {
112+ return {
113+ type : 'babel' ,
114+ version : '7.0.0' ,
115+ program,
116+ } ;
117+ }
118+
119+ return undefined ;
116120 } ,
117121
118122 async transform ( { asset, config, options } ) {
119123 const ast = await asset . getAST ( ) ;
120124
121- if ( ! ast ) {
125+ if ( ! ( ast ?. type === 'babel' && ast . program ) ) {
122126 // We will only receive ASTs for assets we're interested in.
123127 // Since this is undefined (or in node modules) we aren't interested in it.
124128 return [ asset ] ;
@@ -185,7 +189,7 @@ export default new Transformer<ParcelTransformerOpts>({
185189 asset . setAST ( {
186190 type : 'babel' ,
187191 version : '7.0.0' ,
188- program : result ? .ast ,
192+ program : result . ast ,
189193 } ) ;
190194 }
191195
You can’t perform that action at this time.
0 commit comments