Skip to main content

Configuration

Configuration

View the default configuration
wfm.config.ts
import { defineConfig } from "@whitigol/fivem-compiler";

export default defineConfig({
// Watch for file changes in the specified directories and subdirectories.
// This configuration allows targeted builds by specifying different scopes: server, client, or all files.
// Use these options with build flags such as --skip-server or --skip-client for more control.
watch: {
server: ["src/server/**/*.{lua,ts,js}"], // Files specific to the server-side codebase
client: ["src/client/**/*.{lua,ts,js}"], // Files specific to the client-side codebase
all: ["src/data/**/*", "src/stream/**/*"], // Shared files, including assets and data
},

// Define files or folders to copy from the project source to the output destination.
// Each entry specifies a source path (from) and a destination path (to), relative to the project and output roots.
//! DO NOT USE A LEADING SLASH — IT WILL BREAK THE BUILD!
copy: [
{
from: "src/stream/**/*", // Directory containing files for FiveM's streaming functionality (e.g., models, textures)
to: "stream", // Target location in the root of the output directory
},
{
from: "src/data/**/*", // Directory for configuration or supplemental data files
to: "data", // Target location in the root of the output directory
},
/*
{
* Single File Example

from: "src/nested/single-file.txt", // Specify the exact file to copy
to: "into/any/path/from/resource/root/filename.txt", // Target path including filename

? Note: If you change the filename in the "to" path, it will rename the file after moving it.
},
*/
],

// Skips moving files defined in the "copy" option during watch mode.
// This helps speed up build times in development, especially for large files
// (e.g., assets in the "stream" folder) that you only want to move during a build.
skipCopyDuringWatch: true,

//! WARNING: Minification is discouraged and may violate FiveM's Terms of Service. Use at your own risk.
//* Note: Minification is not supported for Lua files.
minify: false,

//! WARNING: Obfuscation is discouraged and may violate FiveM's Terms of Service. Use at your own risk.
//* Note: Obfuscation is not supported for Lua files.
obfuscate: false, //? Enabling this option may significantly increase build times.

// Configuration for the output resource directory.
resource: {
// Specify the root output directory for the final built resource.
//* NOTE: If the "OUTPUT_DIR" environment variable is defined, it will override this value.
//! DO NOT USE A LEADING SLASH — IT WILL BREAK THE BUILD!
directory: "resource",
},
});

Additional Config Imports

isDev

View the isDev usage
import { defineConfig, isDev } from "@whitigol/fivem-compiler";

watch: {
server: ["src/server/**/*.{lua,ts,js}"],
client: ["src/client/**/*.{lua,ts,js}"],
all: ["src/data/**/*", "src/stream/**/*"],
},

copy: [
{
from: "src/stream/**/*",
to: "stream",
},
{
from: "src/data/**/*",
to: "data",
},
],

skipCopyDuringWatch: true,

minify: !isDev, // Only minify the code in production

obfuscate: isDev, // Only obfuscate the code in development

resource: {
directory: "resource",
},

Configuration Reference

This page provides detailed information about the configuration options available for the @whitigol/fivem-compiler.

Configuration Options

watch

Specifies the directories and file types to watch for changes during development. This enables targeted builds and supports the use of --skip-server or --skip-client flags.

watch: {
server: ["src/server/**/*.{lua,ts,js}"], // Files specific to the server-side codebase
client: ["src/client/**/*.{lua,ts,js}"], // Files specific to the client-side codebase
all: ["src/data/**/*", "src/stream/**/*"], // Shared files, including assets and data
}

copy

Defines files or folders to copy from the project source to the output destination.

copy: [
{
from: "/src/stream", // Files for FiveM's streaming functionality
to: "/stream", // Output location in the root directory
},
{
from: "/src/data", // Data files or configurations
to: "/data", // Output location in the root directory
},
];

minify

Enables or disables minification of the output files.

Warning: Minification is discouraged as it may violate FiveM's Terms of Service. Not supported for Lua files.

minify: false,

obfuscate

Enables or disables obfuscation of the output files.

Warning: Obfuscation is discouraged as it may violate FiveM's Terms of Service. Not supported for Lua files.

obfuscate: false,

resource

Specifies the output directory for the final resource build.

Note: This value will be overridden if the OUTPUT_DIR environment variable is defined.

resource: {
directory: "/resource", // Output directory for the resource build
}

skipCopyDuringWatch

Skips moving files defined in the copy option during watch mode. This can help improve build times during development, especially for large files like those in the stream folder.

skipCopyDuringWatch: false,

entry

Defines the entry files for the server and client.

Note: Changing these values is not recommended.

entry: {
server: "src/server/index.*", // Main entry point for server-side code
client: "src/client/index.*", // Main entry point for client-side code
}
© 2025 Whitigol. All Rights ReservedDocumentation Designed and Developed by Whitigol