Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded files are not readable under Windows #9852

Closed
sonovice opened this issue Apr 2, 2024 · 3 comments
Closed

Embedded files are not readable under Windows #9852

sonovice opened this issue Apr 2, 2024 · 3 comments
Labels
bug Something isn't working windows An issue that only occurs on Windows

Comments

@sonovice
Copy link

sonovice commented Apr 2, 2024

What version of Bun is running?

1.1.0

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64

What steps can reproduce the bug?

embed-file.js:

import file_0 from "./test.extension"

const file = Bun.file(file_0);
const content = await file.text();
console.log(content);

test.extension (weird extension picked on purpose to not use any loader)

Hello bundows!

Steps:

$ bun build .\embed-file.js --compile --outfile=test.exe 
$ .\test.exe

What is the expected behavior?

I expect the content of test.extension to be printed: Hello bundows!.

What do you see instead?

$ .\test.exe                                                        
ENOENT: No such file or directory
   errno: -2
 syscall: "open"
   path: "B:/~BUN/root/test-bc146bb2e6512b0c.extension"

Additional information

no response

@sonovice sonovice added the bug Something isn't working label Apr 2, 2024
@sonovice
Copy link
Author

sonovice commented Apr 2, 2024

Turns out to be a slash/backslash issue. Manually replacing the path to be B:\~BUN\root\test-bc146bb2e6512b0c.extension solves the issue.

@Jarred-Sumner
Copy link
Collaborator

This was fixed in I think Bun v1.1.5. I am no longer able to reproduce this in Bun v1.1.6

@sonovice
Copy link
Author

Thanks, @Jarred-Sumner ! One question: Is it possible to manually set the loader when importing files? I would like to import .js files without parsing them, simply as bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows An issue that only occurs on Windows
Projects
None yet
Development

No branches or pull requests

3 participants