mirror of https://github.com/folke/lazy.nvim.git
fix(loader): add auto loaded module to package.loaded early to prevent require loops
This commit is contained in:
parent
9a374a0fb4
commit
18d1c1b47e
|
@ -552,16 +552,17 @@ function M.loader(modname)
|
|||
end
|
||||
|
||||
if ret then
|
||||
M.auto_load(modname, ret.modpath)
|
||||
local mod = package.loaded[modname]
|
||||
if type(mod) == "table" then
|
||||
if type(mod) ~= "table" then
|
||||
mod = loadfile(ret.modpath, nil, nil, ret.stat)()
|
||||
end
|
||||
package.loaded[modname] = mod
|
||||
M.auto_load(modname, ret.modpath)
|
||||
-- selene: allow(incorrect_standard_library_use)
|
||||
return function()
|
||||
return mod
|
||||
end
|
||||
end
|
||||
-- selene: allow(incorrect_standard_library_use)
|
||||
return loadfile(ret.modpath, nil, nil, ret.stat)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in New Issue