Skip to content

Support for custom module resolution #2947

Closed
@rhys-vdw

Description

@rhys-vdw

We have a custom module loader that uses full file paths to resolve files.

local units = VFS.Include("luaui/configs/unit_buildmenu_config.lua")

To get proper type inference we need to add @module to every call.

---@module "unit_buildmenu_config"
local units = VFS.Include("luaui/configs/unit_buildmenu_config.lua")

It's possible to alias VFS.Include to act like require:

  "runtime.special": {
    "VFS.include": "require"
  },

But this won't work because VFS.Include accepts a path, and require accepts a module name. Is there any way to write a custom module resolver so that we can support VFS.Include project-wide?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions