fix(cache): add hack to work-around incorrect requires back. Not a fan of this. Fixes #603

This commit is contained in:
Folke Lemaitre 2023-02-28 12:38:10 +01:00
parent 77223786aa
commit 79f85e5fed
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 0 deletions

View File

@ -231,6 +231,12 @@ function Cache.find(modname, opts)
local basename = modname:gsub("%.", "/") local basename = modname:gsub("%.", "/")
local idx = modname:find(".", 1, true) local idx = modname:find(".", 1, true)
-- HACK: fix incorrect require statements. Really not a fan of keeping this
if idx == 1 then
modname = modname:gsub("^%.+", "")
basename = modname:gsub("%.", "/")
idx = modname:find(".", 1, true)
end
local topmod = idx and modname:sub(1, idx - 1) or modname local topmod = idx and modname:sub(1, idx - 1) or modname
-- OPTIM: search for a directory first when topmod == modname -- OPTIM: search for a directory first when topmod == modname