fivem-bundler is a build-time compiler designed for FiveM Lua resources, currently at version 1.1.2. It analyzes `client/` and `server/` directories, resolving standard Lua `require()` and `ox_lib.require()` calls through Abstract Syntax Tree (AST) analysis. The primary function is to consolidate multiple Lua files into single-file bundles for both client and server runtimes, injecting all modules into Lua's `package.preload`. This approach optimizes resource loading and simplifies deployment for FiveM servers. Key differentiators include its automatic detection of resource structure (directory or fxmanifest.lua driven), explicit support for `ox_lib` semantics, and a 'lazy' bundling feature for modules that should be available on-demand but not auto-executed. While a specific release cadence isn't published, the `1.x.x` versioning suggests ongoing, active development. It requires Node.js >=18.0.0 to run.
npm install fivem-bundlerVerified import paths — ran on the pinned version, not inferred.
This demonstrates global installation and basic bundling of the current directory, or using npx for a specific resource with an explicit output directory and specifying lazy modules.
Refactor Lua code to use only static string literals for module paths in `require()` statements.
Update your `fxmanifest.lua` to include `client_script 'dist/client.lua'` and `server_script 'dist/server.lua'`.
Ensure Lua file paths are consistent and reflect the desired module ID. E.g., `client/modules/targeting.lua` becomes `modules.targeting`.
Upgrade your Node.js installation to version 18 or newer. Use `nvm` or your system's package manager for Node.js management.
Change `local myModule = require(getModuleName())` to `local myModule = require("my.module.name")`.Either install globally with `npm i -g fivem-bundler` or prefix the command with `npx`, e.g., `npx fivem-bundler .`.
Verify the module ID matches the file path (e.g., `modules.targeting` for `client/modules/targeting.lua`). Check if the file is correctly placed in `client/`, `server/`, or `shared/` directories or listed in `fxmanifest.lua`.
No dependency data recorded yet.