Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not force lowercase paths with requires using aliases #172

Closed
PhantomShift opened this issue Apr 6, 2024 · 0 comments
Closed

Do not force lowercase paths with requires using aliases #172

PhantomShift opened this issue Apr 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@PhantomShift
Copy link
Contributor

The ability to require source files using aliases for paths is useful, but one of the annoyances in the current implementation is that paths are forced to lowercase when checking aliases from .luaurc files. For example, if I set an alias entry "deps": "../../deps", and then deps contains some file that isn't in lowercase like DataHandler.lua, then the following code will fail with the error No file exists at the path 'deps/datahandler'.

local DataHandler = require("@deps/DataHandler")

I note that this is enforced specifically here, which is then appended to the resolved path of the alias here.

My understanding of the relevant RFC for require by alias is that although the alias itself is expected to be treated as case insensitive, any appended paths should be left as-is, such as in the example they provide in the document.

-- Suppose "@src" is an alias for the same directory as "../../../../../"

-- Instead of this:
local result = require("../../../../../HelperModules/graphing")

-- We could have this:
local result = require("@src/HelperModules/graphing")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants