Weave.jl report generation fails in PackageCompiler.jl App

I’m encountering an issue when generating a report from a compiled application that uses Weave.jl, which I built with PackageCompiler.jl.

Initially, I received the following error:

┌ Warning: Error generating report!
│   (e, stacktrace(catch_backtrace())) =
│    IOError: readdir("C:\\Users\\USER\\A\\share\\julia\\stdlib\\v1.10"): no such file or directory (ENOENT)
│    Stacktrace:
│      [1] uv_error
│        @ .\libuv.jl:100 [inlined]
│      [2] readdir(dir::String; join::Bool, sort::Bool)
│        @ Base.Filesystem .\file.jl:869
│      [3] readdir
│        @ .\file.jl:862 [inlined]
│      [4] is_stdlib(pkgid::Base.PkgId)
│        @ Base .\loading.jl:310
│      [5] identify_package_env(where::Base.PkgId, name::String)
│        @ Base .\loading.jl:351
│      [6] identify_package_env
│        @ .\loading.jl:330 [inlined]
│      [7] macro expansion
│        @ .\loading.jl:1826 [inlined]
│      [8] macro expansion
│        @ .\lock.jl:267 [inlined]
│      [9] __require(into::Module, mod::Symbol)
│        @ Base .\loading.jl:1823
│     [10] #invoke_in_world#3
│        @ .\essentials.jl:926 [inlined]
│     [11] invoke_in_world
│        @ .\essentials.jl:923 [inlined]
│     [12] require(into::Module, mod::Symbol)
│        @ Base .\loading.jl:1816
│     [13] eval
│        @ .\boot.jl:385 [inlined]
│     [14] run_doc(doc::Weave.WeaveDoc; doctype::String, out_path::String, args::Dict{Symbol, Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, cache::Symbol)
│        @ Weave C:\Users\USER\.julia\packages\Weave\f7Ly3\src\run.jl:38
│     [15] weave(source::RelocatableFolders.Path; doctype::String, informat::Nothing, out_path::String, args::Dict{Symbol, Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, 
cache::Symbol, template::Nothing, css::Nothing, highlight_theme::Nothing, pandoc_options::Vector{String}, latex_cmd::Vector{String}, keep_unicode::Bool)
│        @ Weave C:\Users\USER\.julia\packages\Weave\f7Ly3\src\Weave.jl:176
│     [16] report(app::MyPackage.AppData; plotwidth::Int64)
│        @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\tasks\reporting.jl:33
│     [17] report
│        @ C:\Users\USER\.julia\dev\MyPackage\src\tasks\reporting.jl:12 [inlined]
│     [18] generate_report(app::MyPackage.AppData)
│        @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\callbacks\callbacks_gtk_task_report.jl:64
│     [19] (::MyPackage.var"#320#325"{MyPackage.AppData})()
│        @ MyPackage C:\Users\USER\.julia\packages\Gtk4\7UvLz\src\GLib\loop.jl:61
│     [20] GSourceFunc(user_data::Function)
│        @ Gtk4.GLib C:\Users\USER\.julia\packages\Gtk4\7UvLz\src\gen\glib_structs:738
│     [21] run(app::Gtk4.GtkApplicationLeaf)
│        @ Gtk4.GLib C:\Users\USER\.julia\packages\Gtk4\7UvLz\src\GLib\loop.jl:220
│     [22] start_UI()
│        @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\start_UI.jl:150
│     [23] main_MyPackage()
│        @ MyApp C:\Users\USER\Documents\App\PackageCompiler_play\MyApp\src\MyApp.jl:169
│     [24] top-level scope
│        @ none:1
└ @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\callbacks\callbacks_gtk_task_report.jl:67

This error indicated that the compiled application could not find the standard library (stdlib) at the path C:\\Users\\USER\\A\\share\\julia\\stdlib\\v1.10.

So, I manually copied files from C:\Users\USER\.julia\juliaup\julia-1.10.10+0.x64.w64.mingw32\share\julia\stdlib\v1.10 to the compiled application’s directory at C:\\Users\\USER\\A\\share\\julia\\stdlib\\v1.10.

After this, the error changed to:

 Warning: Error generating report!
│   (e, stacktrace(catch_backtrace())) =
│    ArgumentError: Package Weave does not have Serialization in its dependencies:
│    - You may have a partially installed environment. Try `Pkg.instantiate()`
│      to ensure all packages in the environment are installed.
│    - Or, if you have Weave checked out for development and have
│      added Serialization as a dependency but haven't updated your primary
│      environment's manifest file, try `Pkg.resolve()`.
│    - Otherwise you may need to report an issue with Weave
│    Stacktrace:
│      [1] macro expansion
│        @ .\loading.jl:1846 [inlined]
│      [2] macro expansion
│        @ .\lock.jl:267 [inlined]
│      [3] __require(into::Module, mod::Symbol)
│        @ Base .\loading.jl:1823
│      [4] #invoke_in_world#3
│        @ .\essentials.jl:926 [inlined]
│      [5] invoke_in_world
│        @ .\essentials.jl:923 [inlined]
│      [6] require(into::Module, mod::Symbol)
│        @ Base .\loading.jl:1816
│      [7] eval
│        @ .\boot.jl:385 [inlined]
│      [8] run_doc(doc::Weave.WeaveDoc; doctype::String, out_path::String, args::Dict{Symbol, Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, cache::Symbol)
│        @ Weave C:\Users\USER\.julia\packages\Weave\f7Ly3\src\run.jl:38
│      [9] weave(source::RelocatableFolders.Path; doctype::String, informat::Nothing, out_path::String, args::Dict{Symbol, Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, 
cache::Symbol, template::Nothing, css::Nothing, highlight_theme::Nothing, pandoc_options::Vector{String}, latex_cmd::Vector{String}, keep_unicode::Bool)
│        @ Weave C:\Users\USER\.julia\packages\Weave\f7Ly3\src\Weave.jl:176
│     [10] report(app::MyPackage.AppData; plotwidth::Int64)
│        @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\tasks\reporting.jl:33
│     [11] report
│        @ C:\Users\USER\.julia\dev\MyPackage\src\tasks\reporting.jl:12 [inlined]
│     [12] generate_report(app::MyPackage.AppData)
│        @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\callbacks\callbacks_gtk_task_report.jl:64
│     [13] (::MyPackage.var"#320#325"{MyPackage.AppData})()
│        @ MyPackage C:\Users\USER\.julia\packages\Gtk4\7UvLz\src\GLib\loop.jl:61
│     [14] GSourceFunc(user_data::Function)
│        @ Gtk4.GLib C:\Users\USER\.julia\packages\Gtk4\7UvLz\src\gen\glib_structs:738
│     [15] run(app::Gtk4.GtkApplicationLeaf)
│        @ Gtk4.GLib C:\Users\USER\.julia\packages\Gtk4\7UvLz\src\GLib\loop.jl:220
│     [16] start_UI()
│        @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\start_UI.jl:150
│     [17] main_MyPackage()
│        @ MyApp C:\Users\USER\Documents\App\PackageCompiler_play\MyApp\src\MyApp.jl:169
│     [18] top-level scope
│        @ none:1
└ @ MyPackage C:\Users\USER\.julia\dev\MyPackage\src\callbacks\callbacks_gtk_task_report.jl:67

I am compiling the application using the following PackageCompiler command:

create_app(
    project_dir,
    build_dir;
    executables= ["My_UI" => "main_MyPackage"], 
    include_lazy_artifacts=true,
    force = true,
    precompile_execution_file = joinpath(project_dir, "precompile.jl")
)

During the package compilation process, the precompile.jl file is executed, and it generates the report without any errors. So the issue arise only in the compiled app. Any solution / suggestion I could try?