Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错:Cannot read property 'loaded' of null #1

Open
mrzhang90 opened this issue Aug 18, 2021 · 0 comments
Open

报错:Cannot read property 'loaded' of null #1

mrzhang90 opened this issue Aug 18, 2021 · 0 comments

Comments

@mrzhang90
Copy link

问题描述:

image

问题分析:

resolve(require(filename)) //执行到这句会报错

问题解决:

我做了尝试,

require.cache[targetFile] = null;
// 这里把key删除即可解决报错
delete require.cache[targetFile];

我分析是原因只把require的cache对应文件的value置为null,那么key依然存在的,node还是从缓存中读的,所以把key也删除就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant