Skip to content

Commit a692bf8

Browse files
committedJul 21, 2024
revert: fix(loader): add auto loaded module to package.loaded early to prevent require loops
This reverts commit 18d1c1b.
1 parent 8bef074 commit a692bf8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
 

‎lua/lazy/core/loader.lua

+6-7
Original file line numberDiff line numberDiff line change
@@ -552,16 +552,15 @@ function M.loader(modname)
552552
end
553553

554554
if ret then
555+
M.auto_load(modname, ret.modpath)
555556
local mod = package.loaded[modname]
556-
if type(mod) ~= "table" then
557-
mod = loadfile(ret.modpath, nil, nil, ret.stat)()
557+
if type(mod) == "table" then
558+
return function()
559+
return mod
560+
end
558561
end
559-
package.loaded[modname] = mod
560-
M.auto_load(modname, ret.modpath)
561562
-- selene: allow(incorrect_standard_library_use)
562-
return function()
563-
return mod
564-
end
563+
return loadfile(ret.modpath, nil, nil, ret.stat)
565564
end
566565
end
567566

0 commit comments

Comments
 (0)