Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Bust modules cache when cwd changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Jul 17, 2016
1 parent 9867291 commit 4ecf133
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ const defaultIds = [
'lodash-compat'
];

let oldCwd;
const ids = [];
const modules = new MapCache;

/*----------------------------------------------------------------------------*/

export default function config({ cwd=process.cwd(), id=defaultIds }={}) {
if (oldCwd !== cwd) {
oldCwd = cwd;
modules.clear();
}
_.each(_.castArray(id), id => {
if (!modules.get(id)) {
const moduleRoot = ModuleCache.resolve(id, cwd);
Expand Down

0 comments on commit 4ecf133

Please sign in to comment.