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
{ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "profiles": { "dev": { "optimize": { "dead-code": true } } }}export const RED = "ff0000"print("hello"){ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "profiles": { "dev": { "optimize": { "dead-code": true } } }}export const RED = "ff0000"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`
Related codes
| code | message |
|---|---|
| W1003 | Unused local, parameter or import |
Offline
$ wowlua explain W6002 W6002 (warning): Side-effect-free, unused module removed by dead-code elimination