@@ -41,7 +41,7 @@ defmodule ElixirScript.Compiler do
4141
4242 def compile ( path , opts ) when is_binary ( path ) do
4343 opts = build_compiler_options ( opts )
44- { :ok , pid } = State . start_link ( )
44+ { :ok , pid } = State . start_link ( opts )
4545
4646 path = if String . ends_with? ( path , [ ".ex" , ".exs" ] ) do
4747 path
@@ -64,7 +64,7 @@ defmodule ElixirScript.Compiler do
6464
6565 def compile ( entry_modules , opts ) do
6666 opts = build_compiler_options ( opts )
67- { :ok , pid } = State . start_link ( )
67+ { :ok , pid } = State . start_link ( opts )
6868
6969 entry_modules = List . wrap ( entry_modules )
7070
@@ -90,11 +90,13 @@ defmodule ElixirScript.Compiler do
9090 end
9191
9292 defp build_compiler_options ( opts ) do
93+ remove_used_functions? = Keyword . get ( opts , :remove_unused_functions , true )
94+
9395 default_options = Map . new
9496 |> Map . put ( :output , Keyword . get ( opts , :output ) )
9597 |> Map . put ( :format , :es )
9698 |> Map . put ( :root , Keyword . get ( opts , :root , "." ) )
97- |> Map . put ( :remove_unused_functions , Keyword . get ( opts , :remove_unused_functions , Mix . env == :prod ) )
99+ |> Map . put ( :remove_unused_functions , remove_used_functions? )
98100
99101 options = default_options
100102 Map . put ( options , :module_formatter , ES )
0 commit comments