fix: dont autoload cached modules when module=false

This commit is contained in:
Folke Lemaitre 2022-12-20 16:02:22 +01:00
parent 992c6791ef
commit 316503f124
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 3 additions and 0 deletions

View File

@ -54,6 +54,9 @@ function M.check_path(modname, modpath)
local plugin = require("lazy.core.plugin").find(modpath) local plugin = require("lazy.core.plugin").find(modpath)
if plugin and modpath:find(plugin.dir, 1, true) == 1 then if plugin and modpath:find(plugin.dir, 1, true) == 1 then
if not plugin._.loaded then if not plugin._.loaded then
if plugin.module == false then
error("Plugin " .. plugin.name .. " is not loaded and is configured with module=false")
end
require("lazy.core.loader").load(plugin, { require = modname }) require("lazy.core.loader").load(plugin, { require = modname })
end end
return true return true