Hello!
I’m trying to set up a small Elixir app that depends on jason via another package. Using mix release
works, but as soon as I set MIX_ENV=prod
I get one of the following errors, nondeterministically:
→ MIX_ENV=prod mix release
==> jason
Compiling 10 files (.ex)
== Compilation error in file lib/encode.ex ==
** (SyntaxError) invalid syntax found on lib/encode.ex:318:57:
error: unexpected token: "\" (column 57, code point U+005C)
│
318 │ slash_escapes = Enum.zip(~c"\b\t\n\f\r\\"\\", ~c"btnfr\"\\")
│ ^
│
└─ lib/encode.ex:318:57
(elixir 1.16.0) lib/kernel/parallel_compiler.ex:428: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
could not compile dependency :jason, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile jason --force", update it with "mix deps.update jason" or clean it with "mix deps.clean jason"
→ MIX_ENV=prod mix release
==> jason
Compiling 10 files (.ex)
== Compilation error in file lib/decoder.ex ==
** (SyntaxError) invalid syntax found on lib/decoder.ex:825:24:
error: unexpected token: "\" (column 24, code point U+005C)
│
825 │ when byte in ~c"\s\n\r\t" do
│ ^
│
└─ lib/decoder.ex:825:24
(elixir 1.16.0) lib/kernel/parallel_compiler.ex:428: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
could not compile dependency :jason, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile jason --force", update it with "mix deps.update jason" or clean it with "mix deps.clean jason"
I’ve looked at the code in jason
and it looks innocuous:
slash_escapes = Enum.zip(~c"\b\t\n\f\r\\"\\", ~c"btnfr\"\\")
Does MIX_ENV=prod
change something about the Elixir language?