lloyAlloy on GitHub
Modules
Docs

Modules

Imports are sugar over require

Updated

Paths pass through unchanged. A Luau alias, a relative path, or a package works the way it already does. Type-only imports cost nothing at runtime.

Alloymodules.aly
1import { add, type Item } from "./inventory"
2import * as React from "@packages/react"
3export const MAX = 64
Emitted Luausame line count
1local _m1 = require("./inventory") local add = _m1.add type Item = _m1.Item
2local React = require("@packages/react")
3const MAX = 64 return { MAX = MAX }
  • Every form: { a, b as c, type T }, * as M, a default name, and import type.
  • Exports gather into the table the module returns at the end of its scope; export default returns one value.
  • Completion inside the braces lists the target module's exports, and a missing name offers an auto-import.
  • .aly, .alx, and .luau require each other freely, since all of them compile to .luau.