Skip to content

Deprecate old module system - rewrite imports to use require instead of lazy-loading #830

Open

Description

@thelindat

The old Lua module system using lazy-loading on the lib global needs to be deprecated, then used only for

  • exports (exports.ox_lib.method)
  • imported data from init.lua (e.g. lib.name)
  • deprecated modules for backwards compatibility

Ideally we can strive for 1:1 parity between Lua and JS modules, keeping all the logic, functions, classes, and behaviour the same where possible. Some modules may be better off being rewritten or entirely deprecated.

Some require paths can simply use the old import logic under-the-hood, or lib could be updated to hotload v2 modules where appropriate. Probably best to just update them as they become relevant, however.


From this point, any pull requests that want to implement new features must use modules instead of imports. Supporting JS for that feature is optional, but preferred. With the exception of bug fixes, any pull requests which modify or add a new file to imports will be closed or asked to adapt the new module system.

All modules must be typed as accurately as possible and include the ---@meta [name] annotation to support Lua Language Server module resolution (see DataView supporting require "Ox.DataView").


The following modules require rewrites that would break compatibility:

  • callbacks (needs class support, rename to rpc or such)

The following modules are fully deprecated and should be ignored:

  • disableControls

Anything not listed above is under consideration and may be deprecated, refactored, or receive a complete rewrite depending on future needs/discussions.

Activity

  1. added theissue type on Oct 9, 2026
  2. pinned this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions