Skip to content

Commit 08655e9

Browse files
committed
fix: reset preloader before trying to load the module
1 parent 66946c7 commit 08655e9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lua/noice/util/hacks.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,15 @@ function M.on_module(module, fn)
274274
if package.loaded[module] then
275275
return fn(package.loaded[module])
276276
end
277+
277278
package.preload[module] = function()
278-
for l, loader in pairs(package.loaders) do
279-
if l > 1 then
280-
local ret = loader(module)
281-
if type(ret) == "function" then
282-
local mod = ret()
283-
fn(mod)
284-
return mod
285-
end
279+
package.preload[module] = nil
280+
for _, loader in pairs(package.loaders) do
281+
local ret = loader(module)
282+
if type(ret) == "function" then
283+
local mod = ret()
284+
fn(mod)
285+
return mod
286286
end
287287
end
288288
end

0 commit comments

Comments
 (0)