v0.13.6
errors and warnings / bundling

errors and warnings / bundling / W6002

W6002 warning

Side-effect-free, unused module removed by dead-code elimination

area
bundling (x6xxx)
fails the build
with --deny-warnings

With optimize.dead-code (on in release builds), a module was left out of the build: its top level only declares things (functions, constants, classes, types, locals set to literals or tables), it runs no code and registers nothing, and no other module imports it. Removing it changes nothing in game; the warning tells you it is unused.

Delete the module if you no longer need it. If plain Lua code reaches it by name (__wowlua.require("id")), list it in build.keep. The examples turn dead-code removal on for the dev profile, so that wowlua check sees it.

Example

× failswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "profiles": { "dev": { "optimize": { "dead-code": true } } }}
src/colors.wowluawowlua
export const RED = "ff0000"
src/main.wowluawowlua
print("hello")
✓ compileswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "profiles": { "dev": { "optimize": { "dead-code": true } } }}
src/colors.wowluawowlua
export const RED = "ff0000"
src/main.wowluawowlua
import RED from "/colors"print(RED)

The compiler reports it like this:

warning[W6002]: this module is removed: it only declares things and nothing uses it
 = in src/colors.wowlua
 = help: import it where it is needed, or list it in `build.keep`
codemessage
W1003Unused local, parameter or import

Offline

terminal
$ wowlua explain W6002
W6002 (warning): Side-effect-free, unused module removed by dead-code elimination

source on GitHub ↗