import-fresh
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -27,7 +27,7 @@ 'use strict'; | ||
// Delete module from cache | ||
delete require.cache[filePath]; | ||
delete require.cache[filePath]; // Delete module from cache | ||
// Return fresh module | ||
return require.cache[parentPath].require(filePath); | ||
const parent = require.cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step | ||
return parent === undefined ? require(filePath) : parent.require(filePath); // In case cache doesn't have parent, fall back to normal require | ||
}; |
{ | ||
"name": "import-fresh", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Import a module while bypassing the cache", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4833
45
1