Closed Renotje6 closed 3 days ago
This is basically impossible to statically analyze for properly. You need to use the --include
flag to include the files you need for deno compile
. https://docs.deno.com/runtime/reference/cli/compiler/#compile-options-include
If you're having an issue with the --include
flag, then please open a new issue with a reproduction.
Description: I'm attempting to dynamically import files based on a glob pattern using the
expandGlob
function from@std/fs
. The code functions as expected during development, but when I compile the script into an executable, the files matching the glob pattern are not included.Here's a the function:
Steps to Reproduce
deno compile --target x86_64-pc-windows-msvc src/main.ts
(change target based on os)Expected Behavior
The executable should include all files matching the glob pattern so they can be dynamically imported at runtime.
Actual Behavior
The files matching the glob pattern are not included in the compiled executable, resulting in import errors at runtime. However, if I use static imports, the files are correctly included in the executable.
Additional Information
Deno Version: 2.0.6
@std/fs
version: 1.0.4Using static strings works as expected, so this issue seems specific to dynamic imports with
expandGlob
. I've tried using the--include
flag to specify matching files, but it still does not resolve the issue.Expected Resolution Support for dynamic imports with glob patterns in compiled executables, or documentation on correctly including files matched by
expandGlob
.