Skip to content

Commit

Permalink
Lazy Import: Delete cache on second require attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed May 28, 2020
1 parent d883925 commit 7b63dbc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/lazy-import/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ async function lazyImport( arg, options = {} ) {
throw error;
}

// Delete cache from prior `require` attempt.
delete require.cache[ require.resolve( localModule ) ];

return require( localModule );
}
Expand Down

0 comments on commit 7b63dbc

Please sign in to comment.