diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index a0b1428..72d5a06 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -268,7 +268,18 @@ function Spec:import(spec) ---@diagnostic disable-next-line: no-unknown package.loaded[modname] = nil Util.try(function() - self:normalize(require(modname)) + local mod = require(modname) + if type(mod) ~= "table" then + self.importing = nil + return self:error( + "Invalid spec module: `" + .. modname + .. "`\nExpected a `table` of specs, but a `" + .. type(mod) + .. "` was returned instead" + ) + end + self:normalize(mod) self.importing = nil Util.track() end, {