Skip to content

Commit

Permalink
fix(cache): only autoload when plugins have been parsed. Needed to su…
Browse files Browse the repository at this point in the history
…pport `import`
  • Loading branch information
folke committed Jan 2, 2023
1 parent f6b0172 commit 0bc73db
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lua/lazy/core/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ function M.check_autoload(modname, modpath)
if plugin and modpath:find(plugin.dir, 1, true) == 1 then
-- we're not interested in loader time, so calculate delta here
M.stats.autoload.time = M.stats.autoload.time + uv.hrtime() - start
if not plugin._.loaded then
if plugin.module == false then
error("Plugin " .. plugin.name .. " is not loaded and is configured with module=false")
-- only autoload when plugins have been loaded
if #require("lazy.core.config").plugins > 0 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 })
end
require("lazy.core.loader").load(plugin, { require = modname })
end
return true
end
Expand Down

0 comments on commit 0bc73db

Please sign in to comment.