When using Gulp 4 and Babel, placing import-fresh inside a function causes a TypeError. The odd thing is this doesn't happen if the import-fresh call happens at root:
// Works as expected:
var works = importFresh(path.resolve('./src/stuff'))
function something() {
// Errors out:
var worksNot = importFresh(path.resolve('./src/otherStuff'))
}
The error:
TypeError: Cannot read property 'getFileName' of undefined
at module.exports (/(...)/node_modules/caller-path/index.js:4:40)
at module.exports.moduleId (/(...)/node_modules/import-fresh/index.js:11:44)
at imported (/(...)/gulpfile.babel.js:14:14)
at /(...)/gulpfile.babel.js:28:2
at taskWrapper (/(...)/node_modules/undertaker/lib/set-task.js:13:15)
at bound (domain.js:301:14)
at runBound (domain.js:314:12)
at asyncRunner (/(...)/node_modules/async-done/index.js:55:18)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
When the same script runs without Babel, it works as expected. So there's something weird happening with Babel / ES2015 conversion.
When using Gulp 4 and Babel, placing
import-fresh
inside a function causes a TypeError. The odd thing is this doesn't happen if theimport-fresh
call happens at root:The error:
When the same script runs without Babel, it works as expected. So there's something weird happening with Babel / ES2015 conversion.