清除require的缓存

清除require的缓存机制,require之前清除缓存

const pkgPath = `${process.cwd()}/package.json`
delete require.cache[require.resolve(pkgPath)]
let projectPkg = require(pkgPath)

你可能感兴趣的:(清除require的缓存)