@@ -17,12 +17,11 @@ function M.load(modname, modpath)
17
17
--- @type (string | fun ())?
18
18
local chunk = Cache .get (modname )
19
19
20
- if chunk then
21
- local hash = Cache .hash (modpath )
22
- if hash ~= M .hashes [modname ] then
23
- M .hashes [modname ] = hash
24
- chunk = nil
25
- end
20
+ local hash = Cache .hash (modpath )
21
+ if hash ~= M .hashes [modname ] then
22
+ M .hashes [modname ] = hash
23
+ Cache .del (modname )
24
+ chunk = nil
26
25
end
27
26
28
27
if chunk then
@@ -32,9 +31,8 @@ function M.load(modname, modpath)
32
31
vim .notify (" loadfile(" .. modname .. " )" )
33
32
end )
34
33
chunk , err = loadfile (modpath )
35
- if chunk then
34
+ if chunk and not err then
36
35
Cache .set (modname , string.dump (chunk ))
37
- M .hashes [modname ] = M .hashes [modname ] or Cache .hash (modpath )
38
36
end
39
37
end
40
38
@@ -56,7 +54,7 @@ function M.setup()
56
54
57
55
-- preload core modules
58
56
local root = vim .fn .fnamemodify (debug.getinfo (1 , " S" ).source :sub (2 ), " :p:h:h" )
59
- for _ , name in ipairs ({ " util" , " config" , " loader" , " state" }) do
57
+ for _ , name in ipairs ({ " util" , " config" , " loader" , " state" , " plugin " }) do
60
58
local modname = " lazy.core." .. name
61
59
--- @diagnostic disable-next-line : no-unknown
62
60
package.preload [modname ] = function ()
0 commit comments