Git Product home page Git Product logo

Comments (14)

Jarred-Sumner avatar Jarred-Sumner commented on July 19, 2024 2

@jackyzha0 looks like there's a bug where the outfile is becoming the basename instead of the directory, so --outfile=dist/foo becomes foo

from bun.

paperdave avatar paperdave commented on July 19, 2024

working as intended. --compile sets --target=bun and some other flags, as it is not possible to use --compile without them set.

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

Why is this working as intended? The --compile flag should raise an error if it fails to build the binary

from bun.

Jarred-Sumner avatar Jarred-Sumner commented on July 19, 2024

Is it failing to build the binary? --compile supports .node files

from bun.

paperdave avatar paperdave commented on July 19, 2024

Why is this working as intended?

The error is due to the default value of --format (browser), see

To load node files, set target to "bun"

With --compile, this is flipped to --target=bun

It seems this is not clear and documentation and error messages should be revised.

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

Yes, it fails to emit the binary. This still happens with --target=bun, let me see if I can put together a minimal repro for yall

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

Ah it actually does seem to compile properly but it doesn't seem to respect --outfile

image

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

https://github.com/jackyzha0/bun-compile-repro

from bun.

paperdave avatar paperdave commented on July 19, 2024

thank you for the reproduction. this specifically only happens when a node file is included

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

hey, any pointers on where I can look to maybe submit a PR for this?

from bun.

paperdave avatar paperdave commented on July 19, 2024

build_command.zig line 297, in that code block i suspect this might be.

may be worth checking if this happens without --compile. seems likely since the absolute outfile is already decided it might not actually be, not 100% sure.

StandaloneModuleGraph.zig line 525 might be the wrong directory

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

Confirmed that this bug was not present in v1.0.23 or v1.0.24 (but only on Mac OS??) bug seems to affect only Linux from my tests so far. Let me backdate a few versions to confirm

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024
var output_dir = this_bundler.options.output_dir;
if (outfile.len > 0 and output_files.len == 1 and output_files[0].value == .buffer) {
    output_dir = std.fs.path.dirname(outfile) orelse ".";
    output_files[0].dest_path = std.fs.path.basename(outfile);
}

I suspect it might be here (L299 in bun/src/cli/build_command.zig)? For including .node files, output_files.len > 1 so this path to properly set output_dir never gets hit?

hm nvm that doesn't seem to be it

from bun.

jackyzha0 avatar jackyzha0 commented on July 19, 2024

spent a few hours looking at it but couldn't figure it out :( would appreciate if yall could help take a look when you get the chance!

from bun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.