Skip to content

Commit

Permalink
Merge pull request #29 from rollup/fix-preflight-check-caching
Browse files Browse the repository at this point in the history
Ensure caching works properly for repeated calls with the same `dir`.
  • Loading branch information
Rich-Harris authored and Andarist committed Dec 17, 2019
1 parent abb7ce9 commit fb48680
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/rollup-plugin-babel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const BUNDLED = {};
let preflightCheckResults = {};

function preflightCheck ( options, dir ) {
let helpers;

if ( !preflightCheckResults[ dir ] ) {
let helpers;

options = assign( {}, options );
options.filename = join( dir, 'x.js' );

Expand All @@ -30,9 +30,11 @@ function preflightCheck ( options, dir ) {
else {
throw new Error( 'An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!' );
}

preflightCheckResults[ dir ] = helpers;
}

return preflightCheckResults[ dir ] = helpers;
return preflightCheckResults[ dir ];
}

function assign ( target, source ) {
Expand Down

0 comments on commit fb48680

Please sign in to comment.