Skip to content

Commit

Permalink
revert: fix(loader): add auto loaded module to package.loaded early t…
Browse files Browse the repository at this point in the history
…o prevent require loops

This reverts commit 18d1c1b.
  • Loading branch information
folke committed Jul 21, 2024
1 parent 8bef074 commit a692bf8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lua/lazy/core/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,15 @@ function M.loader(modname)
end

if ret then
M.auto_load(modname, ret.modpath)
local mod = package.loaded[modname]
if type(mod) ~= "table" then
mod = loadfile(ret.modpath, nil, nil, ret.stat)()
if type(mod) == "table" then
return function()
return mod
end
end
package.loaded[modname] = mod
M.auto_load(modname, ret.modpath)
-- selene: allow(incorrect_standard_library_use)
return function()
return mod
end
return loadfile(ret.modpath, nil, nil, ret.stat)
end
end

Expand Down

0 comments on commit a692bf8

Please sign in to comment.