Git Product home page Git Product logo

Comments (3)

A-D-E-A avatar A-D-E-A commented on August 16, 2024

NestJS uses optional/peer dependencies for many modules, such as "@nestjs/microservices" and "class-validator" in your example.

To efficiently compile, bun needs to bundle all modules required by the code, even the ones you don't actually use. Have you tried installing all these libraries before compiling? It may fix the problem in the meantime. You could also set all these dependencies as "external" in your build step I guess.

However, it would be nice to allow compilation with these unknown modules.
Maybe with a flag like "--allow-missing-deps" or something?
And it would also be nice to document this behavior.

from bun.

joy-stacks avatar joy-stacks commented on August 16, 2024

NestJS uses optional/peer dependencies for many modules, such as "@nestjs/microservices" and "class-validator" in your example.

To efficiently compile, bun needs to bundle all modules required by the code, even the ones you don't actually use. Have you tried installing all these libraries before compiling? It may fix the problem in the meantime. You could also set all these dependencies as "external" in your build step I guess.

However, it would be nice to allow compilation with these unknown modules. Maybe with a flag like "--allow-missing-deps" or something? And it would also be nice to document this behavior.

thanks

from bun.

A-D-E-A avatar A-D-E-A commented on August 16, 2024

With v1.1.21 there's the new --packages=external flag. I didn't test it, but since the problem is due to optional dependencies, I bet it would solve the issue if it can be coupled with --compile.

Still, it would be nice to document that compilation with missing packages (add a warning about optional and peer dependencies, which are the most likely to trigger this) crashes. And that you have to either add the --packages=external flag, manually set the not-needed packages as externals, or install all of them.

I'm still rooting for an --allow-missing-deps flag of some sort, but that's probably just me.

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.