in static: blocks or {.compileTime.} functions writeFile is not available with the JS backend.
$ cat writeFile.nim
static:
"/dev/stdout".writeFile "\x1b[1;35mhello writeFile!\x1b[0m\n"
$ nim c -o:/dev/null --verbosity:0 writeFile.nim
hello writeFile!
$ nim js -o:/dev/null --verbosity:0 writeFile.nim
writeFile.nim(2, 16) Error: undeclared identifier: 'writeFile'
$ nim --version
Nim Compiler Version 0.11.2 (2015-07-15) [Linux: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf
git hash: 45b6082c12dd6fc90a3dd3ca97e1ba157c3d6464